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 <peff@peff.net> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lars Schneider committed Feb 25, 2016 at 09:42 UTC 658df95a4adb825f0c8a5faea7b545da6d1d5003
3 files changed +18 -1
.travis.yml
+1 -1
@@ -21,12 +21,12 @@ addons:
21
22 env:
23 global:
24 + - DEVELOPER=1
25 - P4_VERSION="15.2"
26 - GIT_LFS_VERSION="1.1.0"
27 - DEFAULT_TEST_TARGET=prove
28 - GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
29 - GIT_TEST_OPTS="--verbose --tee"
29 - - CFLAGS="-g -O2 -Wall -Werror"
30 - GIT_TEST_CLONE_2GB=YesPlease
31 # t9810 occasionally fails on Travis CI OS X
32 # t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X
Documentation/CodingGuidelines
+5
@@ -171,6 +171,11 @@ For C programs:
171
172 - We try to keep to at most 80 characters per line.
173
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 +
179 - We try to support a wide range of C compilers to compile Git with,
180 including old ones. That means that you should not use C99
181 initializers, even if a lot of compilers grok it.
Makefile
+12
@@ -380,6 +380,18 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
380 ALL_LDFLAGS = $(LDFLAGS)
381 STRIP ?= strip
382
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 +
395 # Create as necessary, replace existing, make ranlib unneeded.
396 ARFLAGS = rcs
397