2018-04-14 22:19:45 +03:00
|
|
|
ifeq ($(filter no-error,$(DEVOPTS)),)
|
2018-04-14 22:19:44 +03:00
|
|
|
CFLAGS += -Werror
|
2018-04-14 22:19:45 +03:00
|
|
|
endif
|
2018-07-24 22:26:43 +03:00
|
|
|
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
|
|
|
CFLAGS += -pedantic
|
|
|
|
# don't warn for each N_ use
|
|
|
|
CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
|
|
|
endif
|
2018-04-14 22:19:44 +03:00
|
|
|
CFLAGS += -Wdeclaration-after-statement
|
2018-09-08 19:23:31 +03:00
|
|
|
CFLAGS += -Wformat-security
|
2018-04-14 22:19:44 +03:00
|
|
|
CFLAGS += -Wno-format-zero-length
|
|
|
|
CFLAGS += -Wold-style-definition
|
|
|
|
CFLAGS += -Woverflow
|
|
|
|
CFLAGS += -Wpointer-arith
|
|
|
|
CFLAGS += -Wstrict-prototypes
|
|
|
|
CFLAGS += -Wunused
|
|
|
|
CFLAGS += -Wvla
|
|
|
|
|
|
|
|
ifndef COMPILER_FEATURES
|
|
|
|
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
|
|
|
CFLAGS += -Wtautological-constant-out-of-range-compare
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
|
|
|
|
CFLAGS += -Wextra
|
|
|
|
# if a function is public, there should be a prototype and the right
|
|
|
|
# header file should be included. If not, it should be static.
|
|
|
|
CFLAGS += -Wmissing-prototypes
|
2018-04-14 22:19:46 +03:00
|
|
|
ifeq ($(filter extra-all,$(DEVOPTS)),)
|
2018-04-14 22:19:44 +03:00
|
|
|
# These are disabled because we have these all over the place.
|
|
|
|
CFLAGS += -Wno-empty-body
|
|
|
|
CFLAGS += -Wno-missing-field-initializers
|
|
|
|
CFLAGS += -Wno-sign-compare
|
|
|
|
CFLAGS += -Wno-unused-parameter
|
|
|
|
endif
|
2018-04-14 22:19:46 +03:00
|
|
|
endif
|
2018-04-14 22:19:44 +03:00
|
|
|
|
|
|
|
# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
|
|
|
|
# not worth fixing since newer compilers correctly stop complaining
|
|
|
|
ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
|
|
|
|
ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
|
|
|
|
CFLAGS += -Wno-uninitialized
|
|
|
|
endif
|
|
|
|
endif
|