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