Repository navigation
Fix -Wunused-parameter (Clang only) - #1536
Conversation
Unlike GCC, Clang warns about unused parameters in uninstantiated templates, breaking every TU that includes Rcpp under `-Wextra -Werror`.
|
Thanks. I think our status is still 'progress towards -Wextra -Werror'. |
|
I just tried to random packages of mine with |
|
This was Clang 23.1.6 (and GCC 16.2.1, but that one was fine) against |
|
So you got this from installing Rcpp itself? |
|
I've compiled every C++ file in this repo with |
|
Thanks for being more specific and getting a reproducible example. What my first comment above was trying to hint at was that I do not think we claim that Your PR is fine as such ("does no harm"), I just want to make sure we are at the same starting position. Unless I am mistaken, I think we never claimed one could use |
|
I saw the fixes in 1835865 so just decided to rebase my branch from half a year ago, and this one was left over. RcppArmadillo compiles cleanly for me too after a manual |
|
Thanks for the pointer. I knew we had "done something", I also had the hunch there is still a lot to do so we cannot claim "all is well today for |
There was a problem hiding this comment.
Verified locally against the installed Rcpp headers (1.1.2.8, unpatched):
- Reproduced the failure:
clang++ -Wunused-parameter -Werroron a TU including<Rcpp.h>errors atinst/include/Rcpp/internal/wrap.h:526— the exact uninstantiated-template parameter the PR cites. GCC-15 compiles cleanly, matching the "Clang only" claim. - Patched header compiles clean across C++11/14/17/20 under that flag, and the
/*object*/idiom matches existing usage in Module.h / Promise.h / StretchyList.h. - Semantics unchanged: the commented-out name lives in the unreachable fallback overload (the
static_assertis its only real content), and the tag-dispatch overload selection is untouched. - ChangeLog entry present and in house format.
One note: with a full -Wextra -Werror build, 7 further errors remain (clang's -Wdeprecated-copy-with-user-provided-copy in proxy headers), as already flagged in the comments — this is progress towards -Wextra -Werror, not full compliance. Worth not advertising it as such.
Approving. No test added for the warning: a build-flag regression test isn't practical and CI doesn't gate on -Wextra -Werror.
(NB: The approval comment and underlying (local) tests were done with the assistance of inkling-2-mini.)
|
I will wait a bit for other Rcpp team members to chime in but I think we're good and I plan to merge. Thanks for the fix! |
|
LGTM! |
Clarifying / rewording: I think our prior position was something along the lines of 'we are sympathetic to the goals of |
Unlike GCC, Clang warns about unused parameters in uninstantiated templates, breaking every TU that includes Rcpp under
-Wextra -Werror.Pull Request Template for Rcpp
Please explain the changes you want to apply to Rcpp, preferably in an issue ticket before you create a pull request. See the file Contributing and the other templates for details.
Checklist
R CMD checkstill passes all tests