Skip to content

Commit 99f763b

Browse files
avargitster
authored andcommitted
Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER
Add a DEVOPTS variable that'll be used to tweak the behavior of DEVELOPER. I've long wanted to use DEVELOPER=1 in my production builds, but on some old systems I still get warnings, and thus the build would fail. However if the build/tests fail for some other reason, it would still be useful to scroll up and see what the relevant code is warning about. This change allows for that. Now setting DEVELOPER will set -Werror as before, but if DEVOPTS=no-error is provided is set you'll get the same warnings, but without -Werror. Helped-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1da1580 commit 99f763b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,16 @@ all::
435435
# Define DEVELOPER to enable more compiler warnings. Compiler version
436436
# and family are auto detected, but could be overridden by defining
437437
# COMPILER_FEATURES (see config.mak.dev)
438+
#
439+
# When DEVELOPER is set, DEVOPTS can be used to control compiler
440+
# options. This variable contains keywords separated by
441+
# whitespace. The following keywords are are recognized:
442+
#
443+
# no-error:
444+
#
445+
# suppresses the -Werror that implicitly comes with
446+
# DEVELOPER=1. Useful for getting the full set of errors
447+
# without immediately dying, or for logging them.
438448

439449
GIT-VERSION-FILE: FORCE
440450
@$(SHELL_PATH) ./GIT-VERSION-GEN

config.mak.dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
ifeq ($(filter no-error,$(DEVOPTS)),)
12
CFLAGS += -Werror
3+
endif
24
CFLAGS += -Wdeclaration-after-statement
35
CFLAGS += -Wno-format-zero-length
46
CFLAGS += -Wold-style-definition

0 commit comments

Comments
 (0)