Makefile: detect compiler and enable more warnings in DEVELOPER=1
[git/debian.git] / config.mak.dev
blob716a14ecc7da86a8ab4997b220ca2e7b12d43da4
1 CFLAGS += -Werror
2 CFLAGS += -Wdeclaration-after-statement
3 CFLAGS += -Wno-format-zero-length
4 CFLAGS += -Wold-style-definition
5 CFLAGS += -Woverflow
6 CFLAGS += -Wpointer-arith
7 CFLAGS += -Wstrict-prototypes
8 CFLAGS += -Wunused
9 CFLAGS += -Wvla
11 ifndef COMPILER_FEATURES
12 COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
13 endif
15 ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
16 CFLAGS += -Wtautological-constant-out-of-range-compare
17 endif
19 ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
20 CFLAGS += -Wextra
21 # if a function is public, there should be a prototype and the right
22 # header file should be included. If not, it should be static.
23 CFLAGS += -Wmissing-prototypes
24 # These are disabled because we have these all over the place.
25 CFLAGS += -Wno-empty-body
26 CFLAGS += -Wno-missing-field-initializers
27 CFLAGS += -Wno-sign-compare
28 CFLAGS += -Wno-unused-function
29 CFLAGS += -Wno-unused-parameter
30 endif
32 # uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
33 # not worth fixing since newer compilers correctly stop complaining
34 ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
35 ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
36 CFLAGS += -Wno-uninitialized
37 endif
38 endif