developer: enable pedantic by default

With the codebase firmly C99 compatible and most compilers supporting newer versions by default, it could help bring visibility to problems. Reverse the DEVOPTS=pedantic flag to provide a fallback for people stuck with gcc < 5 or some other compiler that either doesn't support this flag or has issues with it, and while at it also enable -Wpedantic which used to be controversial[1] when Apple compilers and clang had widely divergent version numbers. Ideally any compiler found to have issues with these flags will be added to an exception, and indeed, one was added to safely process windows headers that would use non standard print identifiers, but it is expected that more will be needed, so it could be considered a weather balloon. [1] https://lore.kernel.org/git/20181127100557.53891-1-carenas@gmail.com/ Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Carlo Marcelo Arenas Belón committed Sep 3, 2021 at 10:02 UTC 6a8cbc41bacb853e723b1ae3fcc2277535d2ba52
2 files changed +5 -3
Makefile
+2 -2
@@ -486,9 +486,9 @@ all::
486 # setting this flag the exceptions are removed, and all of
487 # -Wextra is used.
488 #
489 -# pedantic:
489 +# no-pedantic:
490 #
491 -# Enable -pedantic compilation.
491 +# Disable -pedantic compilation.
492
493 GIT-VERSION-FILE: FORCE
494 @$(SHELL_PATH) ./GIT-VERSION-GEN
config.mak.dev
+3 -1
@@ -7,9 +7,11 @@ DEVELOPER_CFLAGS += -Werror
7 SPARSE_FLAGS += -Wsparse-error
8 endif
9 DEVELOPER_CFLAGS += -Wall
10 -ifneq ($(filter pedantic,$(DEVOPTS)),)
10 +ifeq ($(filter no-pedantic,$(DEVOPTS)),)
11 DEVELOPER_CFLAGS += -pedantic
12 +DEVELOPER_CFLAGS += -Wpedantic
13 ifneq ($(filter gcc5,$(COMPILER_FEATURES)),)
14 +DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
15 DEVELOPER_CFLAGS += -Wno-incompatible-pointer-types
16 endif
17 endif