BUILD: makefile: add FAILFAST to select the -Wfatal-errors behavior

-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
This commit is contained in:
Willy Tarreau 2024-04-11 15:08:14 +02:00
parent 617e646ec0
commit fc27ed9f18
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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),)