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" (<20180329150322.10722-4-pclouds@gmail.com>; https://public-inbox.org/git/20180329150322.10722-4-pclouds@gmail.com/) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Apr 14, 2018 at 19:19 UTC
26d2e4fb227c1415011a136fa9bb881ee338118a
2 files changed
+8
Makefile
+6
@@ -445,6 +445,12 @@ all::
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.
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.
454
455
GIT-VERSION-FILE: FORCE
456
@$(SHELL_PATH) ./GIT-VERSION-GEN
config.mak.dev
+2
@@ -23,6 +23,7 @@ CFLAGS += -Wextra
23
# if a function is public, there should be a prototype and the right
24
# header file should be included. If not, it should be static.
25
CFLAGS += -Wmissing-prototypes
26
+ifeq ($(filter extra-all,$(DEVOPTS)),)
27
# These are disabled because we have these all over the place.
28
CFLAGS += -Wno-empty-body
29
CFLAGS += -Wno-missing-field-initializers
@@ -30,6 +31,7 @@ CFLAGS += -Wno-sign-compare
31
CFLAGS += -Wno-unused-function
32
CFLAGS += -Wno-unused-parameter
33
endif
34
+endif
35
36
# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
37
# not worth fixing since newer compilers correctly stop complaining