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