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