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