]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: globally enable -Wundef
authorWilly Tarreau <w@1wt.eu>
Mon, 30 Aug 2021 04:02:47 +0000 (06:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 Aug 2021 08:16:30 +0000 (10:16 +0200)
As seen in issue #1369, supporting #if with unknown macros can silently
hide typos that may result in suboptimal code paths to be used, or even
possibly bugs. It looks like our code base does not rely that much on
this, so it's worth enabling -Wundef to catch future ones and have them
turned to more explicit "#if defined()" or #ifdef.

Makefile

index 9a3c8bcd22a4fdd673f88860c3288a597a075fe4..d0a7862b678570436a30263ecfcdadc3b3752136 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -191,7 +191,7 @@ REG_TEST_SCRIPT=./scripts/run-regtests.sh
 # We rely on signed integer wraparound on overflow, however clang think it
 # can do whatever it wants since it's an undefined behavior, so use -fwrapv
 # to be sure we get the intended behavior.
-SPEC_CFLAGS := -Wall -Wextra -Wdeclaration-after-statement
+SPEC_CFLAGS := -Wall -Wextra -Wundef -Wdeclaration-after-statement
 SPEC_CFLAGS += $(call cc-opt-alt,-fwrapv,$(call cc-opt,-fno-strict-overflow))
 SPEC_CFLAGS += $(call cc-nowarn,address-of-packed-member)
 SPEC_CFLAGS += $(call cc-nowarn,unused-label)