Add a DEVOPTS variable that'll be used to tweak the behavior of DEVELOPER. I've long wanted to use DEVELOPER=1 in my production builds, but on some old systems I still get warnings, and thus the build would fail. However if the build/tests fail for some other reason, it would still be useful to scroll up and see what the relevant code is warning about. This change allows for that. Now setting DEVELOPER will set -Werror as before, but if DEVOPTS=no-error is provided is set you'll get the same warnings, but without -Werror. Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
ifeq ($(filter no-error,$(DEVOPTS)),)
|
|
CFLAGS += -Werror
|
|
endif
|
|
CFLAGS += -Wdeclaration-after-statement
|
|
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
|
|
# 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-function
|
|
CFLAGS += -Wno-unused-parameter
|
|
endif
|
|
|
|
# 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
|