зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
2b647a05d7
Коммит
729b3925ed
5
Makefile
5
Makefile
|
@ -484,6 +484,11 @@ all::
|
||||||
# The DEVELOPER mode enables -Wextra with a few exceptions. By
|
# The DEVELOPER mode enables -Wextra with a few exceptions. By
|
||||||
# setting this flag the exceptions are removed, and all of
|
# setting this flag the exceptions are removed, and all of
|
||||||
# -Wextra is used.
|
# -Wextra is used.
|
||||||
|
#
|
||||||
|
# pedantic:
|
||||||
|
#
|
||||||
|
# Enable -pedantic compilation. This also disables
|
||||||
|
# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
|
||||||
|
|
||||||
GIT-VERSION-FILE: FORCE
|
GIT-VERSION-FILE: FORCE
|
||||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
ifeq ($(filter no-error,$(DEVOPTS)),)
|
ifeq ($(filter no-error,$(DEVOPTS)),)
|
||||||
CFLAGS += -Werror
|
CFLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
||||||
|
CFLAGS += -pedantic
|
||||||
|
# don't warn for each N_ use
|
||||||
|
CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
||||||
|
endif
|
||||||
CFLAGS += -Wdeclaration-after-statement
|
CFLAGS += -Wdeclaration-after-statement
|
||||||
CFLAGS += -Wno-format-zero-length
|
CFLAGS += -Wno-format-zero-length
|
||||||
CFLAGS += -Wold-style-definition
|
CFLAGS += -Wold-style-definition
|
||||||
|
|
Загрузка…
Ссылка в новой задаче