Skip to content

Commit 658df95

Browse files
larsxschneidergitster
authored andcommitted
add DEVELOPER makefile knob to check for acknowledged warnings
We assume Git developers have a reasonably modern compiler and recommend them to enable the DEVELOPER makefile knob to ensure their patches are clear of all compiler warnings the Git core project cares about. Enable the DEVELOPER makefile knob in the Travis-CI build. Suggested-by: Jeff King <[email protected]> Signed-off-by: Lars Schneider <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48c39e9 commit 658df95

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ addons:
2121

2222
env:
2323
global:
24+
- DEVELOPER=1
2425
- P4_VERSION="15.2"
2526
- GIT_LFS_VERSION="1.1.0"
2627
- DEFAULT_TEST_TARGET=prove
2728
- GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
2829
- GIT_TEST_OPTS="--verbose --tee"
29-
- CFLAGS="-g -O2 -Wall -Werror"
3030
- GIT_TEST_CLONE_2GB=YesPlease
3131
# t9810 occasionally fails on Travis CI OS X
3232
# t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X

Documentation/CodingGuidelines

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ For C programs:
171171

172172
- We try to keep to at most 80 characters per line.
173173

174+
- As a Git developer we assume you have a reasonably modern compiler
175+
and we recommend you to enable the DEVELOPER makefile knob to
176+
ensure your patch is clear of all compiler warnings we care about,
177+
by e.g. "echo DEVELOPER=1 >>config.mak".
178+
174179
- We try to support a wide range of C compilers to compile Git with,
175180
including old ones. That means that you should not use C99
176181
initializers, even if a lot of compilers grok it.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,18 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
380380
ALL_LDFLAGS = $(LDFLAGS)
381381
STRIP ?= strip
382382

383+
ifdef DEVELOPER
384+
CFLAGS += -Werror \
385+
-Wdeclaration-after-statement \
386+
-Wno-format-zero-length \
387+
-Wold-style-definition \
388+
-Woverflow \
389+
-Wpointer-arith \
390+
-Wstrict-prototypes \
391+
-Wunused \
392+
-Wvla
393+
endif
394+
383395
# Create as necessary, replace existing, make ranlib unneeded.
384396
ARFLAGS = rcs
385397

0 commit comments

Comments
 (0)