diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-04-14 19:19:44 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-16 04:54:53 (GMT) |
commit | 1da1580e4c2d482070363edc7b4f8b42874c312a (patch) | |
tree | 28400e2b4abd899817506cc548aed03dfeee5534 /Makefile | |
parent | d2bff22c2369289eac4d17654c464e392e726b3e (diff) | |
download | git-1da1580e4c2d482070363edc7b4f8b42874c312a.zip git-1da1580e4c2d482070363edc7b4f8b42874c312a.tar.gz git-1da1580e4c2d482070363edc7b4f8b42874c312a.tar.bz2 |
Makefile: detect compiler and enable more warnings in DEVELOPER=1
The set of extra warnings we enable when DEVELOPER has to be
conservative because we can't assume any compiler version the
developer may use. Detect the compiler version so we know when it's
safe to enable -Wextra and maybe more.
These warning settings are mostly from my custom config.mak a long
time ago when I tried to enable as many warnings as possible that can
still build without showing warnings. Some of those warnings are
probably worth fixing instead of just suppressing in future.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -431,6 +431,10 @@ all:: # # When cross-compiling, define HOST_CPU as the canonical name of the CPU on # which the built Git will run (for instance "x86_64"). +# +# Define DEVELOPER to enable more compiler warnings. Compiler version +# and family are auto detected, but could be overridden by defining +# COMPILER_FEATURES (see config.mak.dev) GIT-VERSION-FILE: FORCE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -439,15 +443,6 @@ GIT-VERSION-FILE: FORCE # CFLAGS and LDFLAGS are for the users to override from the command line. CFLAGS = -g -O2 -Wall -DEVELOPER_CFLAGS = -Werror \ - -Wdeclaration-after-statement \ - -Wno-format-zero-length \ - -Wold-style-definition \ - -Woverflow \ - -Wpointer-arith \ - -Wstrict-prototypes \ - -Wunused \ - -Wvla LDFLAGS = ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) @@ -1047,7 +1042,7 @@ include config.mak.uname -include config.mak ifdef DEVELOPER -CFLAGS += $(DEVELOPER_CFLAGS) +include config.mak.dev endif comma := , |