2018-04-15 03:19:45 +08:00
|
|
|
ifeq ($(filter no-error,$(DEVOPTS)),)
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Werror
|
2018-04-15 03:19:45 +08:00
|
|
|
endif
|
2018-07-25 03:26:43 +08:00
|
|
|
ifneq ($(filter pedantic,$(DEVOPTS)),)
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -pedantic
|
2018-07-25 03:26:43 +08:00
|
|
|
# don't warn for each N_ use
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
|
|
|
|
endif
|
|
|
|
DEVELOPER_CFLAGS += -Wall
|
|
|
|
DEVELOPER_CFLAGS += -Wdeclaration-after-statement
|
|
|
|
DEVELOPER_CFLAGS += -Wformat-security
|
|
|
|
DEVELOPER_CFLAGS += -Wno-format-zero-length
|
|
|
|
DEVELOPER_CFLAGS += -Wold-style-definition
|
|
|
|
DEVELOPER_CFLAGS += -Woverflow
|
|
|
|
DEVELOPER_CFLAGS += -Wpointer-arith
|
|
|
|
DEVELOPER_CFLAGS += -Wstrict-prototypes
|
|
|
|
DEVELOPER_CFLAGS += -Wunused
|
|
|
|
DEVELOPER_CFLAGS += -Wvla
|
2018-04-15 03:19:44 +08:00
|
|
|
|
|
|
|
ifndef COMPILER_FEATURES
|
|
|
|
COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
|
2018-04-15 03:19:44 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Wextra
|
2018-04-15 03:19:44 +08:00
|
|
|
# if a function is public, there should be a prototype and the right
|
|
|
|
# header file should be included. If not, it should be static.
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Wmissing-prototypes
|
2018-04-15 03:19:46 +08:00
|
|
|
ifeq ($(filter extra-all,$(DEVOPTS)),)
|
2018-04-15 03:19:44 +08:00
|
|
|
# These are disabled because we have these all over the place.
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Wno-empty-body
|
|
|
|
DEVELOPER_CFLAGS += -Wno-missing-field-initializers
|
|
|
|
DEVELOPER_CFLAGS += -Wno-sign-compare
|
|
|
|
DEVELOPER_CFLAGS += -Wno-unused-parameter
|
2018-04-15 03:19:44 +08:00
|
|
|
endif
|
2018-04-15 03:19:46 +08:00
|
|
|
endif
|
2018-04-15 03:19:44 +08: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)),)
|
2019-02-22 22:41:27 +08:00
|
|
|
DEVELOPER_CFLAGS += -Wno-uninitialized
|
2018-04-15 03:19:44 +08:00
|
|
|
endif
|
|
|
|
endif
|