build: quiet annoying warnings without adding new ones #7954

pull theuni wants to merge 1 commits into bitcoin:master from theuni:clean-warnings changing 1 files +15 −6
  1. theuni commented at 5:18 AM on April 27, 2016: member

    addresses #7394 and some of #7902

    Disabling warnings can be tricky, because doing so can cause a different compiler to create new warnings about unsupported disable flags. Also, some warnings don't surface until they're paired with another warning (gcc). For example, adding "-Wno-foo" won't cause any trouble, but if there's a legitimate warning emitted, the "unknown option -Wno-foo" will show up as well.

    Work around this in 2 ways:

    1. When checking to see if -Wno-foo is supported, check for "-Wfoo" instead.
    2. Enable -Werror while checking 1.

    If "-Werror -Wfoo" compiles, "-Wno-foo" is almost guaranteed to be supported.

    -Werror itself is also checked. If that fails to compile by itself, it likely means that the user added a flag that adds a warning. In that case, -Werror won't be used while checking, and the build may be extra noisy. The user would need to fix the bad input flag.

    Also, silence 2 more additional warnings that can show up post-c++11.

  2. build: quiet annoying warnings without adding new ones
    Disabling warnings can be tricky, because doing so can cause a different
    compiler to create new warnings about unsupported disable flags. Also, some
    warnings don't surface until they're paired with another warning (gcc). For
    example, adding "-Wno-foo" won't cause any trouble, but if there's a legitimate
    warning emitted, the "unknown option -Wno-foo" will show up as well.
    
    Work around this in 2 ways:
    
    1. When checking to see if -Wno-foo is supported, check for "-Wfoo" instead.
    2. Enable -Werror while checking 1.
    
    If "-Werror -Wfoo" compiles, "-Wno-foo" is almost guaranteed to be supported.
    
    -Werror itself is also checked. If that fails to compile by itself, it likely
    means that the user added a flag that adds a warning. In that case, -Werror
    won't be used while checking, and the build may be extra noisy. The user would
    need to fix the bad input flag.
    
    Also, silence 2 more additional warnings that can show up post-c++11.
    63b3111f84
  3. btcdrak commented at 7:32 AM on April 27, 2016: contributor

    Tested ACK 63b3111

  4. fanquake commented at 9:06 AM on April 27, 2016: member

    ACK 63b3111

    Diff of the output of ./autogen.sh + ./configure --enable-hardening with the patch.

    @@ -163,6 +163,15 @@ checking for readelf... no
     checking for c++filt... /usr/bin/c++filt
     checking for pkg-config... /usr/local/bin/pkg-config
     checking pkg-config is at least version 0.9.0... yes
    -checking whether C++ compiler accepts -Werror... yes
    -checking whether C++ compiler accepts -Wall... yes
    -checking whether C++ compiler accepts -Wextra... yes
    -checking whether C++ compiler accepts -Wformat... yes
    -checking whether C++ compiler accepts -Wformat-security... yes
    -checking whether C++ compiler accepts -Wunused-parameter... yes
    -checking whether C++ compiler accepts -Wself-assign... yes
    -checking whether C++ compiler accepts -Wunused-local-typedef... yes
    -checking whether C++ compiler accepts -Wdeprecated-register... yes
     checking for port... no
     checking for brew... brew
     checking whether the linker accepts -Wl,-headerpad_max_install_names... yes
    
  5. laanwj added the label Build system on Apr 27, 2016
  6. laanwj merged this on Apr 27, 2016
  7. laanwj closed this on Apr 27, 2016

  8. laanwj referenced this in commit 08b37c5e06 on Apr 27, 2016
  9. codablock referenced this in commit bcabe4c195 on Sep 16, 2017
  10. codablock referenced this in commit aaa3e9de9b on Sep 19, 2017
  11. zkbot referenced this in commit 75604363cc on Dec 1, 2017
  12. zkbot referenced this in commit 6aef4033a7 on Dec 1, 2017
  13. zkbot referenced this in commit 83af270002 on Dec 15, 2017
  14. kotodev referenced this in commit c8a979fc92 on Jan 25, 2018
  15. renium9 referenced this in commit 23640da445 on Feb 6, 2018
  16. MarcoFalke locked this on Sep 8, 2021

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: 2026-04-18 15:15 UTC

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