]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: add FAILFAST to select the -Wfatal-errors behavior
authorWilly Tarreau <w@1wt.eu>
Thu, 11 Apr 2024 13:08:14 +0000 (15:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Apr 2024 15:33:28 +0000 (17:33 +0200)
-Wfatal-errors is set by default and is not supported on older compilers.
Since it's part of all the automatically detected flags, it's painful to
remove when needed. Also it's a matter of taste, some developers might
prefer to get a long list of all errors at once, others prefer that the
build stops immediately after the root cause.

The default is now back to no -Wfatal-errors, and when FAILFAST is set to
any non-empty non-zero value, -Wfatal-errors is added:

 $ make TARGET=linux-glibc USE_OPENSSL=0 USE_QUIC=1 FAILFAST=0 2>&1 | wc
    132     536    6111

 $ make TARGET=linux-glibc USE_OPENSSL=0 USE_QUIC=1 FAILFAST=1 2>&1 | wc
      8      39     362

INSTALL
Makefile

diff --git a/INSTALL b/INSTALL
index e10822d232dcb8e3e615002f3e6a29936222e82e..1a1da4d152e931b8e95f13d7dad93f4a8c8c8080 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -665,7 +665,10 @@ way to get a usable core when you need one. Otherwise, you can set DEBUG to
 If the ERR variable is set to any non-empty value other than "0", then -Werror
 will be added to the compiler so that any build warning will trigger an error.
 This is the recommended way to build when developing, and it is expected that
-contributed patches were tested with ERR=1.
+contributed patches were tested with ERR=1. Similarly, for developers, another
+variable, FAILFAST enables -Wfatal-errors when set to non-empty except 0, and
+makes the compiler stop at the first error instead of scrolling pages. It's
+essentially a matter of taste.
 
 The DEBUG variable is used to extend the CFLAGS and is preset to a list of
 build-time options that are known for providing significant reliability
index 8fe5c8e1bf13de174f2b8986f9509b955e6dd4b5..4c3d3c51d23a203b2582a6cef1415bc191a394e1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -82,6 +82,7 @@
 #   DEP may be cleared to ignore changes to include files during development
 #   DEBUG may be used to set some internal debugging options.
 #   ERR may be set to non-empty to pass -Werror to the compiler
+#   FAILFAST may be set to non-empty to pass -Wfatal-errors to the compiler
 #   ADDINC may be used to complete the include path in the form -Ipath.
 #   ADDLIB may be used to complete the library list in the form -Lpath -llib.
 #   DEFINE may be used to specify any additional define, which will be reported
@@ -205,7 +206,7 @@ STD_CFLAGS  := $(call cc-opt-alt,-fwrapv,-fno-strict-overflow)
 #### Compiler-specific flags to enable/disable certain classes of warnings.
 WARN_CFLAGS := -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 \
                -Wduplicated-cond -Wnull-dereference
-SPEC_CFLAGS := -Wall -Wextra -Wundef -Wdeclaration-after-statement -Wfatal-errors
+SPEC_CFLAGS := -Wall -Wextra -Wundef -Wdeclaration-after-statement
 SPEC_CFLAGS += $(call cc-all-fast,$(WARN_CFLAGS))
 
 SPEC_CFLAGS += $(cc-wnouwo)
@@ -223,6 +224,10 @@ ifneq ($(ERR:0=),)
   SPEC_CFLAGS += -Werror
 endif
 
+ifneq ($(FAILFAST:0=),)
+  SPEC_CFLAGS += -Wfatal-errors
+endif
+
 #### No longer used
 SMALL_OPTS =
 ifneq ($(SMALL_OPTS),)