]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: makefile: avoid testing all -Wno-* options when not needed
authorWilly Tarreau <w@1wt.eu>
Mon, 31 Jan 2022 10:54:16 +0000 (11:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 31 Jan 2022 20:00:35 +0000 (21:00 +0100)
commit7a1e6fe128d6276516bf4ec3a4ce05c16f9dc16d
tree46b692ded36520d5e19a2282601423e18840bcec
parentce672844dd127d36f4b69cdb96e4d37e19d109b6
BUILD: makefile: avoid testing all -Wno-* options when not needed

We already have 9 different warning shutup options and this list grows
with each new version. Testing for their support takes some time at the
makefile's initialisation which is visible on all options (make clean
etc). Some compilers like clang are extremely slow to validate them all
and spend roughly half a second on modern machines to validate all
options. And some compilers are happier than others when passed a -Wno-*
option they do not know:
  - gcc < 4 complains loudly
  - gcc 4 and above do not say anything, unless there is already another
    warning, in which case they will report about the unknown option as
    well, but without affecting the return code
  - clang by default rejects unknown options but supports a special option
    -Wno-unknown-warning-option to silently ignore them

This patch improves the situation a bit by detecting if the compiler
already supports random options, only supports them when called with
-Wno-unknown-warning-option, or not at all. Based on this, a variable
is set to indicate if we can avoid testing for all unknown options and
assume they are supported, and another one is set to hold the optionally
required option to shut the warning. This results in almost halving the
makefile's startup time, which is particularly appreciable with latest
compilers which become really fat (the other half is caused by the same
tests on various cc-opt).
Makefile