Makefile: add a DEVOPTS flag to get pedantic compilation

In the interest of code hygiene, make it easier to compile Git with the flag -pedantic. Pure pedantic compilation with GCC 7.3 results in one warning per use of the translation macro `N_`: warning: array initialized from parenthesized string constant [-Wpedantic] Therefore also disable the parenthesising of i18n strings with -DUSE_PARENS_AROUND_GETTEXT_N=0. Signed-off-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Beat Bolli committed Jul 24, 2018 at 21:26 UTC 729b3925ed962565e0d6cc144a4235fdf9a6aa85
2 files changed +10
Makefile
+5
@@ -484,6 +484,11 @@ all::
484 # The DEVELOPER mode enables -Wextra with a few exceptions. By
485 # setting this flag the exceptions are removed, and all of
486 # -Wextra is used.
487 +#
488 +# pedantic:
489 +#
490 +# Enable -pedantic compilation. This also disables
491 +# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
492
493 GIT-VERSION-FILE: FORCE
494 @$(SHELL_PATH) ./GIT-VERSION-GEN
config.mak.dev
+5
@@ -1,6 +1,11 @@
1 ifeq ($(filter no-error,$(DEVOPTS)),)
2 CFLAGS += -Werror
3 endif
4 +ifneq ($(filter pedantic,$(DEVOPTS)),)
5 +CFLAGS += -pedantic
6 +# don't warn for each N_ use
7 +CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
8 +endif
9 CFLAGS += -Wdeclaration-after-statement
10 CFLAGS += -Wno-format-zero-length
11 CFLAGS += -Wold-style-definition