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