-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: add build option suppress_all_error_on_warn #56647
base: main
Are you sure you want to change the base?
Conversation
Add an option to suppress cases where warnings are on by default Signed-off-by: Michael Dawson <[email protected]>
Review requested:
|
Address comments in #56615 (comment) that there should be a way to opt out of all cases where Warnings are turned into errors. I looked at the history to see if there was any discussion in Werror=unused-result was added Given that the existing configuration option --error_on_warn would have already caught the unused-result if it was turned on, my assumption is that the desired behaviour was that -Werror=unused-result, be on by default and if you used the --error-on-warn configuration that would turn on/off additiona validation. I agree we should make it possible to turn off all instances where warnings are turned into errors, and that is added in this PR. The alternative would be to remove the |
I think you or the reporter misunderstands what that flag does. An unused result warning is a bug. It's not harmless. Disabling the build error makes no sense at all. Fix the error instead. |
I agree. However, when you try the build in a new environment, you usually can get a slew of new warn-errors. Without the ability to turn them back to just warnings, you are stuck in a loop of fix one error, try recompile, fix second error, try recompile…, which gets very annoying when the recompile step runs remotely (i.e. static analyzer service). It is much faster to get all the warnings in one go, fix them all and then validate they are now passing. |
With And even if gcc managed to screw up, just comment out that line in node.gyp for a sec and rebuild. It doesn't merit its own build option. That just sets a bad example. |
Now we are in the weeds, because I think something like that has happened, but not directly to me. 😅 @jackorp, can you chime in? |
I don't disagree with the view that unused results are a bug and should be fixed, but any kind of -Werror, no matter how granular, shouldn't be forced downstream unless upstream builds and tests against libraries where we deliver nodejs. We can of course comment out anything in node.gyp as well as use a completely custom one, but that's just more maintenance for little gain. If there is an option to remove error-on-warn behavior from buildflags of nodejs, why should there be an exception for
It's not even as much about just the compiler but in addition to the C(++) toolchain in use also the entire environment including headers from libraries like OpenSSL and its specific configuration, which was the reason for the failure we observe.
Doing something like Many libraries exist in different versions in different configurations with different patches on different distributions, unless nodejs plans to test against each downstream configuration (which we are not asking) to make sure there isn't such a warning turned error, we'd prefer all these options gated properly in some form. |
Add an option to suppress cases where warnings are on by default