Skip to content

Commit 26d2e4f

Browse files
avargitster
authored andcommitted
Makefile: add a DEVOPTS to get all of -Wextra
Change DEVOPTS to understand a "extra-all" option. When the DEVELOPER flag is enabled we turn on -Wextra, but manually switch some of the warnings it turns on off. This is because we have many existing occurrences of them in the code base. This mode will stop the suppression, let the developer see and decide whether to fix them. This change is a slight alteration of Nguyễn Thái Ngọc Duy EAGER_DEVELOPER mode patch[1] 1. "[PATCH v3 3/3] Makefile: add EAGER_DEVELOPER mode" (<[email protected]>; https://public-inbox.org/git/[email protected]/) Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 99f763b commit 26d2e4f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,12 @@ all::
445445
# suppresses the -Werror that implicitly comes with
446446
# DEVELOPER=1. Useful for getting the full set of errors
447447
# without immediately dying, or for logging them.
448+
#
449+
# extra-all:
450+
#
451+
# The DEVELOPER mode enables -Wextra with a few exceptions. By
452+
# setting this flag the exceptions are removed, and all of
453+
# -Wextra is used.
448454

449455
GIT-VERSION-FILE: FORCE
450456
@$(SHELL_PATH) ./GIT-VERSION-GEN

config.mak.dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ CFLAGS += -Wextra
2323
# if a function is public, there should be a prototype and the right
2424
# header file should be included. If not, it should be static.
2525
CFLAGS += -Wmissing-prototypes
26+
ifeq ($(filter extra-all,$(DEVOPTS)),)
2627
# These are disabled because we have these all over the place.
2728
CFLAGS += -Wno-empty-body
2829
CFLAGS += -Wno-missing-field-initializers
2930
CFLAGS += -Wno-sign-compare
3031
CFLAGS += -Wno-unused-function
3132
CFLAGS += -Wno-unused-parameter
3233
endif
34+
endif
3335

3436
# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
3537
# not worth fixing since newer compilers correctly stop complaining

0 commit comments

Comments
 (0)