From 065843c8767cd7851637b517990221709116b848 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 13 Sep 2017 16:58:27 +0200 Subject: [PATCH] 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. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 089f5889f0..e380ba7cc3 100644 --- a/Makefile +++ b/Makefile @@ -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