BUILD: Makefile: shut certain gcc/clang stupid warnings

The recent gcc and clang are utterly broken and apparently written by
people who don't use them anymore, because they emit warnings that are
impossible to disable in the code, which is the opposite of what a
warning should do. It is however possible to disable these warnings on
the command line.

This patch adds when supported :
   -Wno-format-truncation: bogus warning which is triggered on each
    snprintf() call based on the input type instead of the variables
    ranges, resulting in the impossibility to use "%02d" and similar.

   -Wno-address-of-packed-member: emitted for each and every line in
    ebtree.h by recent clang. Probably that the warning's author has
    never understood the use cases of packed structs and should be
    taught the use cases of the language he writes the compiler for.

   -Wno-null-dereference: emitted by clang on *(int *)0 = 0. The code
    will be updated to use a volatile instead but this recent change
    of behaviour will certainly cause quite some bugs in decades of
    existing code.

Feel free to report new such stupid warnings and to propose patches
to complete this list.
This commit is contained in:
Willy Tarreau 2017-09-13 16:58:27 +02:00
parent d3a7f40359
commit 065843c876
1 changed files with 3 additions and 0 deletions

View File

@ -140,6 +140,9 @@ DEBUG_CFLAGS = -g
# to be sure we get the intended behavior.
SPEC_CFLAGS := -fno-strict-aliasing -Wdeclaration-after-statement
SPEC_CFLAGS += $(call cc-opt,-fwrapv)
SPEC_CFLAGS += $(call cc-opt,-Wno-format-truncation)
SPEC_CFLAGS += $(call cc-opt,-Wno-address-of-packed-member)
SPEC_CFLAGS += $(call cc-opt,-Wno-null-dereference)
#### Memory usage tuning
# If small memory footprint is required, you can reduce the buffer size. There