]> git.ipfire.org Git - thirdparty/git.git/blame - config.mak.dev
A bit more topics before -rc1
[thirdparty/git.git] / config.mak.dev
CommitLineData
27e0c3c6
CMAB
1ifndef COMPILER_FEATURES
2COMPILER_FEATURES := $(shell ./detect-compiler $(CC))
3endif
4
99f763ba 5ifeq ($(filter no-error,$(DEVOPTS)),)
6d5d4b4e 6DEVELOPER_CFLAGS += -Werror
521dc562 7SPARSE_FLAGS += -Wsparse-error
99f763ba 8endif
ebd2e4a1 9
27e0c3c6 10DEVELOPER_CFLAGS += -Wall
6a8cbc41 11ifeq ($(filter no-pedantic,$(DEVOPTS)),)
6d5d4b4e 12DEVELOPER_CFLAGS += -pedantic
ebd2e4a1 13ifneq (($or $(filter gcc5,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
6a8cbc41 14DEVELOPER_CFLAGS += -Wpedantic
ebd2e4a1
CMAB
15ifneq ($(filter gcc10,$(COMPILER_FEATURES)),)
16ifeq ($(uname_S),MINGW)
6a8cbc41 17DEVELOPER_CFLAGS += -Wno-pedantic-ms-format
27e0c3c6 18endif
6d5d4b4e 19endif
ebd2e4a1
CMAB
20endif
21endif
5f463853 22
2b95d94b 23ifneq ($(uname_S),FreeBSD)
5f463853
JK
24ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang7,$(COMPILER_FEATURES))),)
25DEVELOPER_CFLAGS += -std=gnu99
26endif
2b95d94b
JH
27else
28# FreeBSD cannot limit to C99 because its system headers unconditionally
29# rely on C11 features.
30endif
5f463853 31
6d5d4b4e
ÆAB
32DEVELOPER_CFLAGS += -Wdeclaration-after-statement
33DEVELOPER_CFLAGS += -Wformat-security
6d5d4b4e
ÆAB
34DEVELOPER_CFLAGS += -Wold-style-definition
35DEVELOPER_CFLAGS += -Woverflow
36DEVELOPER_CFLAGS += -Wpointer-arith
37DEVELOPER_CFLAGS += -Wstrict-prototypes
38DEVELOPER_CFLAGS += -Wunused
39DEVELOPER_CFLAGS += -Wvla
55391836 40DEVELOPER_CFLAGS += -fno-common
1da1580e 41
1da1580e 42ifneq ($(filter clang4,$(COMPILER_FEATURES)),)
6d5d4b4e 43DEVELOPER_CFLAGS += -Wtautological-constant-out-of-range-compare
1da1580e
NTND
44endif
45
46ifneq ($(or $(filter gcc6,$(COMPILER_FEATURES)),$(filter clang4,$(COMPILER_FEATURES))),)
6d5d4b4e 47DEVELOPER_CFLAGS += -Wextra
1da1580e
NTND
48# if a function is public, there should be a prototype and the right
49# header file should be included. If not, it should be static.
6d5d4b4e 50DEVELOPER_CFLAGS += -Wmissing-prototypes
26d2e4fb 51ifeq ($(filter extra-all,$(DEVOPTS)),)
1da1580e 52# These are disabled because we have these all over the place.
6d5d4b4e
ÆAB
53DEVELOPER_CFLAGS += -Wno-empty-body
54DEVELOPER_CFLAGS += -Wno-missing-field-initializers
55DEVELOPER_CFLAGS += -Wno-sign-compare
56DEVELOPER_CFLAGS += -Wno-unused-parameter
1da1580e 57endif
26d2e4fb 58endif
1da1580e
NTND
59
60# uninitialized warnings on gcc 4.9.2 in xdiff/xdiffi.c and config.c
61# not worth fixing since newer compilers correctly stop complaining
b53a5f24
JK
62#
63# Likewise, gcc older than 4.9 complains about initializing a
64# struct-within-a-struct using just "{ 0 }"
1da1580e
NTND
65ifneq ($(filter gcc4,$(COMPILER_FEATURES)),)
66ifeq ($(filter gcc5,$(COMPILER_FEATURES)),)
6d5d4b4e 67DEVELOPER_CFLAGS += -Wno-uninitialized
b53a5f24 68DEVELOPER_CFLAGS += -Wno-missing-braces
1da1580e
NTND
69endif
70endif
5338ed2b 71
54795d37
JH
72# Old versions of clang complain about initializaing a
73# struct-within-a-struct using just "{0}" rather than "{{0}}". This
74# error is considered a false-positive and not worth fixing, because
75# new clang versions do not, so just disable it.
76#
77# The "bug" was fixed in upstream clang 9.
78#
79# Complicating this is that versions of clang released by Apple have
80# their own version numbers (associated with the corresponding version
81# of XCode) unrelated to the official clang version numbers.
82#
83# The bug was fixed in Apple clang 12.
84#
85ifneq ($(filter clang1,$(COMPILER_FEATURES)),) # if we are using clang
86ifeq ($(uname_S),Darwin) # if we are on darwin
87ifeq ($(filter clang12,$(COMPILER_FEATURES)),) # if version < 12
88DEVELOPER_CFLAGS += -Wno-missing-braces
89endif
90else # not darwin
91ifeq ($(filter clang9,$(COMPILER_FEATURES)),) # if version < 9
92DEVELOPER_CFLAGS += -Wno-missing-braces
93endif
94endif
95endif
96
846a29af
CMAB
97# https://bugzilla.redhat.com/show_bug.cgi?id=2075786
98ifneq ($(filter gcc12,$(COMPILER_FEATURES)),)
99DEVELOPER_CFLAGS += -Wno-error=stringop-overread
100endif
101
5338ed2b 102GIT_TEST_PERL_FATAL_WARNINGS = YesPlease