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