1CFLAGS += -Werror 2CFLAGS += -Wdeclaration-after-statement 3CFLAGS += -Wno-format-zero-length 4CFLAGS += -Wold-style-definition 5CFLAGS += -Woverflow 6CFLAGS += -Wpointer-arith 7CFLAGS += -Wstrict-prototypes 8CFLAGS += -Wunused 9CFLAGS += -Wvla 10 11ifndef COMPILER_FEATURES 12COMPILER_FEATURES := $(shell ./detect-compiler $(CC)) 13endif 14 15ifneq ($(filter clang4,$(COMPILER_FEATURES)),) 16CFLAGS += -Wtautological-constant-out-of-range-compare 17endif 18 19ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),) 20CFLAGS += -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. 23CFLAGS += -Wmissing-prototypes 24# These are disabled because we have these all over the place. 25CFLAGS += -Wno-empty-body 26CFLAGS += -Wno-missing-field-initializers 27CFLAGS += -Wno-sign-compare 28CFLAGS += -Wno-unused-function 29CFLAGS += -Wno-unused-parameter 30endif 31 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 34ifneq ($(filter gcc4,$(COMPILER_FEATURES)),) 35ifeq ($(filter gcc5,$(COMPILER_FEATURES)),) 36CFLAGS += -Wno-uninitialized 37endif 38endif