Merge branch 'bb/make-developer-pedantic'

"make DEVELOPER=1 DEVOPTS=pedantic" allows developers to compile
with -pedantic option, which may catch more problematic program
constructs and potential bugs.

* bb/make-developer-pedantic:
  Makefile: add a DEVOPTS flag to get pedantic compilation
This commit is contained in:
Junio C Hamano 2018-08-15 15:08:22 -07:00
Родитель 706b0b5e8d 729b3925ed
Коммит 8cabe16d9f
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -484,6 +484,11 @@ all::
# The DEVELOPER mode enables -Wextra with a few exceptions. By
# setting this flag the exceptions are removed, and all of
# -Wextra is used.
#
# pedantic:
#
# Enable -pedantic compilation. This also disables
# USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN

Просмотреть файл

@ -1,6 +1,11 @@
ifeq ($(filter no-error,$(DEVOPTS)),)
CFLAGS += -Werror
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 += -Wno-format-zero-length
CFLAGS += -Wold-style-definition