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