Fix -Wextra - #1485
Conversation
|
Thanks but please see the file Contributing.md -- prior discussion is always best before throwing a PR over the fence which touches eighteen files and comes from someone we never interacted with (as far as I can tell). |
|
A priori, I am sympapthetic. I have used
so it is a little outside the norm. We are about to release 1.1.2 in out usual 'January and July' cadence but maybe we can look into this for the release thereafter, i.e. January 2027. |
|
sure, I just thought it was a rather simple change, since it doesn't touch any real logic. Do you want me to close it or leave it open and rebase it later? |
|
Can we maybe decompose it into individual warnings and among the team (with between us decades of You appear to be associated with gentoo. Does |
|
This is unrelated to Gentoo, this is something I'm seeing in our corporate codebase (where we do enable |
|
I am quite religious about |
|
Sure, the biggest problem for the main codebase (not in the headers) is the works? |
|
There should be none in the |
|
In principle I'm okay with this change, but IMHO it's not really about fixing -Wextra warnings, it's about whether we're willing to commit to doing this from now and into the future. That probably also implies us building and testing Rcpp with -Wextra on CI, so we don't regress this in the future. I also worry that there's some amount of divergence in what -Wextra means, based on the compiler used, its version, and so on -- since IIUC the set of compiler flags in -Wextra is itself a moving target. My two cents... |
|
yeah, just double-checked, they're fine (I saw the @kevinushey oh it is, but |
|
.... which is a flag that R itself will complain about as 'not portable' (cf other discussion on |
|
It would have been nice to discuss these as separate issues. My two cents about the copy constructor. In general, I prefer to solve warnings rather than just silencing them. Adding a default constructor does the latter, because it's something the compiler already does for us. Having a custom assignment operator but not a copy constructor is what triggers the warning. So the question for me is whether we need a custom copy operator too, or if the assignment operator is needed at all. Correct me if I'm wrong, but if we remove it, the compiler generates a default one that delegates to the base class, which already handles the assignment nicely (i.e. shares the underlying SEXP, which has the tzone attribute already). |
|
As for
|
|
|
On balance, suggest to
Comments? |
|
Agree to do this post 1.1.2 release. I would open an issue to track all this, and then we need:
|
|
We'll deal with CI once we get to new PRs. For now, let's close this is neither the right time nor the right approach. |
|
@eddelbuettel @Enchufa2 should I send in a PR with just parts of this PR? |
|
@SoapGentoo Can we start with an issue and agree what we want changed and why before we get to a how? See the discussion above: I just added it on a lark on my box directly in
(NB: I am on Ubuntu 26.04 and use the g++ 16 that comes with it ie 16.0.1 20260322.) But as discussed, compiling the package itself does not hit all the code in it. We probably would have to catch a compilation under unit tests too to find more. Or rely on agents to scan the code and then review. That might suggest addressing it one warning at a time. |
Fixing both of these should be easy and catchable with those warnings. |
|
Two points raised in your last comment: a) We would need to go from "will likely" to actually do :) b) Unless all warnings go away, why are we even doing this? |
|
I still think making two of the warnings errors and fixing it is strictly better than the status quo, but if it isn't 100% guaranteed to fix the downstream issue for you, let's leave it then? |
|
I think you misunderstood. Let me try to rephrase. Adding So I see several possible steps and goals as mentioned above. Patching only parts of what I also said we should discuss this as an issue. Maybe we can start that if you, say, open an issue about But let's please also take a moment and stop now and not rapid-fire add even more posts before @Enchufa2 and @kevinushey have a chance to catch up and chime in. |
|
I think that the first task would be to be able to catch warnings from tests. As discussed, they have a pretty good coverage, and this would help us not only with this, but also with #1488 and future issues like that. I see two possible approaches:
I think the second is the cleanest. Once we set on a mechanism to add compilation flags (i.e. manually, or some variable exposed by Then we'll have a pretty good picture of what user code might be triggering, and we can address those warnings. |
|
Adjusting CI is fairly easy as the yaml is just source code. My simply have to set warnings as errors, eg by Shall we create a new issue 'Aiming at -Wextra compliance' with suitable sub-issues? |
Sure! |
Fixes for when building under
-Wextra, particularly for users who want to compile their Rcpp code with-Wextra.Checklist
R CMD checkstill passes all tests