This PR:
- improves the
configure.ac
maintainability by removing compiler warning/error names duplication - shows compiler warnings when compiled with depends
Close #18092.
Split from #20182 as requested by MarcoFalke, ~and is required for it~.
configure.ac
changes alone or before the CI changes: #20182 (comment)
Can’t do the
configure.ac
changes alone or before the CI changes: #20182 (comment)
CI fails without adding --enable-suppress-external-warnings
. Or did I understand you wrong?
Can’t do the
configure.ac
changes alone or before the CI changes: #20182 (comment)
You are suggesting to reorder commits, right? @MarcoFalke are you agree?
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
This change also effectively activates -W... flags for builds with
dependencies.
402- AX_CHECK_COMPILE_FLAG([-Werror=unreachable-code-loop-increment],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
403+ ERROR_CXXFLAGS=$CXXFLAG_WERROR
404 fi
405
406-if test "x$CXXFLAGS_overridden" = "xno"; then
407+if test "x$depends_prefix" != "x" || test "x$CXXFLAGS_overridden" = "xno"; then
"x$var" != "x"
used all over the place instead of -n "$var"
? Or why not just "$CXXFLAGS_overridden" = "no"
?
421@@ -435,6 +422,16 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
422 AX_CHECK_COMPILE_FLAG([-Wdeprecated-register],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-register"],,[[$CXXFLAG_WERROR]])
423 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]])
424 AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"],,[[$CXXFLAG_WERROR]])
425+
426+ dnl This is a temporary workaround. See https://github.com/bitcoin/bitcoin/pull/17919#issuecomment-674404780
427+ AX_CHECK_COMPILE_FLAG([-Wunused-command-line-argument],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-command-line-argument"],,[[$CXXFLAG_WERROR]])
428+
429+ dnl -Wmissing-braces is broken for aggregate initialization of std::array in Clang (where it is enabled by -Wall) before 5.0
in Clang (where it is enabled by -Wall) before 5.0
Don’t we only support Clang 5.0+ now? Why do we need to work around something that happens with Clang < 5.0?
421@@ -435,6 +422,16 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
422 AX_CHECK_COMPILE_FLAG([-Wdeprecated-register],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-register"],,[[$CXXFLAG_WERROR]])
423 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]])
424 AX_CHECK_COMPILE_FLAG([-Wdeprecated-copy],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"],,[[$CXXFLAG_WERROR]])
425+
426+ dnl This is a temporary workaround. See https://github.com/bitcoin/bitcoin/pull/17919#issuecomment-674404780
Can the PR title / description be updated to summarize what’s actually changing here? There’s mention of duplication, which I’m not sure I understand, and no mentions of the main difference in behaviour between master and this PR.
This PR is changing our --enable-werror
option from being a select set of -Werror=x
cases that we’ve added to over time, i.e -Werror=date-time
, to just being -Werror
wholesale. As a result, --enable-werror
would now seemingly be unusable in more scenarios (without --enable-suppress-external-warnings
), given the potential of warnings from system libraries.
I’m not sure why the addition of a diagnostic flag to ERROR_CXXFLAGS
, if it’s also included in WARN_CXXFLAGS
is duplication/redundancy, as they are doing different things.
It would also be nice to know what the broader goal is here. Is it to be able to compile with -Werror
, at basically any cost (i.e potentially suppress lots of things)?
If that’s the case, why are we disabling it entirely for a single warning, i.e in the win64 build, and losing the supposed benefits of having it on, rather than suppressing that single warning just in the CI? i.e adding CXXFLAGS=-Wno-...
to BITCOIN_CONFIG
.
I’ll also note that with this change, our warnings flags are going to be added to CXXFLAGS
, when performing a depends build, regardless of whether CXXFLAGS
has been overridden. I’m not sure if that’s desired, and would be another change in behaviour that isn’t summarized in the PR description or commits.
--enable-werror
would now seemingly be unusable in more scenarios (without--enable-suppress-external-warnings
)
While that is true, strictly speaking, there is also another side to it: --enable-werror
would now catch problems in more scenarios (i.e. scenarios where a warning is added to the code which is not covered by the existent -Werror=foo -Werror=bar
).
Also, to mitigate the “unusable in more scenarios” - it is easy to add --enable-suppress-external-warnings
if the compilation stops due to a warning/error from non-bitcoin code.
I think this is hugely positive change, but yeah, maybe not well described in the PR title and description.
It would also be nice to know what the broader goal is here
The way I see it, it is “Catch maximum warnings, suppress as little as possible”. By “catch” I mean “stop the build” because if there is a warning printout but the build succeeds, then most likely the developer will miss the warning printout or it will be lost and ignored in CI logs.
why are we disabling it entirely for a single warning, i.e in the win64 build, and losing the supposed benefits of having it on,
Notice: win64 builds did not use --enable-werror
even before #20182, so we are not disabling anything.
rather than suppressing that single warning just in the CI? i.e adding CXXFLAGS=-Wno-… to BITCOIN_CONFIG
That seems like a good idea!
🐙 This pull request conflicts with the target branch and needs rebase.
Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.