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