build: Add -Werror=unused… compile flags #21458

pull hebasto wants to merge 4 commits into bitcoin:master from hebasto:210317-error changing 1 files +8 −4
  1. hebasto commented at 1:34 pm on March 17, 2021: member

    With C++17 [[maybe_unused]] attribute it is easy to keep emerged cases in the new code under control.

    This PR does not touch -Wno-unused-parameter as it requires too much of code churning.


    Compiler specific notes:

    1. clang:
    1. gcc
    • -Werror=unused-const-variable with level 2 seems not suitable for C++ code
  2. fanquake added the label Build system on Mar 17, 2021
  3. DrahtBot commented at 8:50 pm on March 17, 2021: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #23191 (build: Disable -Wbraced-scalar-init, which is incompatible with -Wc++11-narrowing by MarcoFalke)
    • #23149 (build: make –enable-werror just -Werror by fanquake)

    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.

  4. practicalswift commented at 9:22 pm on March 19, 2021: contributor

    Concept ACK, but why the removal of -Werror=unused-variable? :)

    Could you describe some tests cases that could be used to verify that the patch in this PR makes the build fail where we expect it to fail?

  5. DrahtBot added the label Needs rebase on Apr 6, 2021
  6. build: Promote -Wunused-variable to -Wunused 86bb9d8e9f
  7. build: Drop -Wno-unused-local-typedef
    -Wunused-local-typedef(s) is covered by -Wunused in both gcc and clang.
    No new warnings fire when compiling.
    33a3554cbb
  8. build: Add clang specific -Werror=unused-... compile flags
    Added flags are disabled by default.
    No new warnings fire when compiling.
    6e9ab1045a
  9. build: Add gcc specific -Werror=unused-const-variable=1 compile flag
    Added flag is disabled by default for C++.
    No new warnings fire when compiling.
    424683d349
  10. hebasto force-pushed on Aug 24, 2021
  11. hebasto commented at 6:15 pm on August 24, 2021: member
    Rebased 22dd4fbf5d123976b2b23860188115cbea036cbd -> 424683d349dd9a748b324b74a58e034abd76a33e (pr21458.01 -> pr21458.02).
  12. DrahtBot removed the label Needs rebase on Aug 24, 2021
  13. DrahtBot added the label Needs rebase on Oct 13, 2021
  14. DrahtBot commented at 5:11 am on October 13, 2021: member

    🐙 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”.

  15. in configure.ac:451 in 424683d349
    447@@ -445,8 +448,10 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
    448   AX_CHECK_COMPILE_FLAG([-Wthread-safety],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety"],,[[$CXXFLAG_WERROR]])
    449   AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]])
    450   AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
    451-  AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
    452-  AX_CHECK_COMPILE_FLAG([-Wunused-member-function],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-member-function"],,[[$CXXFLAG_WERROR]])
    453+  AX_CHECK_COMPILE_FLAG([-Wunused], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused"], [], [$CXXFLAG_WERROR])
    


    fanquake commented at 5:41 am on October 13, 2021:
    In 86bb9d8e9f5e0991bd443c7242b9b8a78704d4eb: -Wunused is already part of -Wall (via -Wmost) for Clang, and is implied by -Wall for GCC, so this should be redundant.
  16. fanquake commented at 5:48 am on October 13, 2021: member
    ~0. I’m not super convinced about the addition of (post rebase, and without -Wunused) two, specific -Wunused-* flags. See also #23269 where I’ve cherry-picked 33a3554cbb30657b9af34802dd610b286aa71a56.
  17. fanquake referenced this in commit a845f1ccc6 on Oct 14, 2021
  18. sidhujag referenced this in commit aad5627fc4 on Oct 14, 2021
  19. fanquake commented at 12:46 pm on November 25, 2021: member
    This needs a rebase, and comments addressed, or can probably be closed.
  20. hebasto closed this on Nov 28, 2021

  21. hebasto deleted the branch on Nov 28, 2021
  22. DrahtBot locked this on Nov 28, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-24 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me