summaryrefslogtreecommitdiff
path: root/config.mak.dev
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-08 06:59:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-08 06:59:21 (GMT)
commite998e7a1880ce3939aa6f7ad4244ad319c1655d1 (patch)
treef08c5acfe18500ae3b667843b1ce4ee21504ca00 /config.mak.dev
parent174774cd519846616edc475fcbc98237409ffc21 (diff)
parent26d2e4fb227c1415011a136fa9bb881ee338118a (diff)
downloadgit-e998e7a1880ce3939aa6f7ad4244ad319c1655d1.zip
git-e998e7a1880ce3939aa6f7ad4244ad319c1655d1.tar.gz
git-e998e7a1880ce3939aa6f7ad4244ad319c1655d1.tar.bz2
Merge branch 'nd/warn-more-for-devs'
The build procedure "make DEVELOPER=YesPlease" learned to enable a bit more warning options depending on the compiler used to help developers more. There also is "make DEVOPTS=tokens" knob available now, for those who want to help fixing warnings we usually ignore, for example. * nd/warn-more-for-devs: Makefile: add a DEVOPTS to get all of -Wextra Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER Makefile: detect compiler and enable more warnings in DEVELOPER=1 connect.c: mark die_initial_contact() NORETURN
Diffstat (limited to 'config.mak.dev')
-rw-r--r--config.mak.dev42
1 files changed, 42 insertions, 0 deletions
diff --git a/config.mak.dev b/config.mak.dev
new file mode 100644
index 0000000..2d244ca
--- /dev/null
+++ b/config.mak.dev
@@ -0,0 +1,42 @@
+ifeq ($(filter no-error,$(DEVOPTS)),)
+CFLAGS += -Werror
+endif
+CFLAGS += -Wdeclaration-after-statement
+CFLAGS += -Wno-format-zero-length
+CFLAGS += -Wold-style-definition
+CFLAGS += -Woverflow
+CFLAGS += -Wpointer-arith
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wunused
+CFLAGS += -Wvla
+
+ifndef COMPILER_FEATURES
+COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
+endif
+
+ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
+CFLAGS += -Wtautological-constant-out-of-range-compare
+endif
+
+ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
+CFLAGS += -Wextra
+# if a function is public, there should be a prototype and the right
+# header file should be included. If not, it should be static.
+CFLAGS += -Wmissing-prototypes
+ifeq ($(filter extra-all,$(DEVOPTS)),)
+# These are disabled because we have these all over the place.
+CFLAGS += -Wno-empty-body
+CFLAGS += -Wno-missing-field-initializers
+CFLAGS += -Wno-sign-compare
+CFLAGS += -Wno-unused-function
+CFLAGS += -Wno-unused-parameter
+endif
+endif
+
+# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
+# not worth fixing since newer compilers correctly stop complaining
+ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
+ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
+CFLAGS += -Wno-uninitialized
+endif
+endif