1ifeq ($(filter no-error,$(DEVOPTS)),) 2CFLAGS += -Werror 3endif 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 26ifeq ($(filter extra-all,$(DEVOPTS)),) 27# These are disabled because we have these all over the place. 28CFLAGS += -Wno-empty-body 29CFLAGS += -Wno-missing-field-initializers 30CFLAGS += -Wno-sign-compare 31CFLAGS += -Wno-unused-function 32CFLAGS += -Wno-unused-parameter 33endif 34endif 35 36# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c 37# not worth fixing since newer compilers correctly stop complaining 38ifneq ($(filter gcc4,$(COMPILER_FEATURES)),) 39ifeq ($(filter gcc5,$(COMPILER_FEATURES)),) 40CFLAGS += -Wno-uninitialized 41endif 42endif