From: Lars Schneider <[email protected]>

The global Travis-CI environment variable CFLAGS did not override the
CFLAGS variable in the makefile. Pass CFLAGS as make variable to
override it properly.

In addition to that, add '-Wdeclaration-after-statement' to make a
Travis-CI build fail (because of '-Werror') if the code does not adhere
to the Git coding style.

Inspired-by: Jeff King <[email protected]>
Signed-off-by: Lars Schneider <[email protected]>
---

I made this patch because Peff pointed out to me that "git style doesn't
allow declaration-after-statement" [1]. I wonder if it would make sense
to add this check even in the makefile [2]? I am no make expert, but I
also wonder why we don't use the override directive [3] for the CFLAGS?
AFAIK this would allow a make invocation like this:

make target CFLAGS+=-Wdeclaration-after-statement

Thanks,
Lars

[1] http://www.spinics.net/lists/git/msg267273.html
[2] 
https://github.com/git/git/blob/ff4ea6004fb48146330d663d64a71e7774f059f9/Makefile#L377
[3] https://www.gnu.org/software/make/manual/make.html#Override-Directive

 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c3bf9c6..29abff4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,7 @@ env:
     - DEFAULT_TEST_TARGET=prove
     - GIT_PROVE_OPTS="--timer --jobs 3"
     - GIT_TEST_OPTS="--verbose --tee"
-    - CFLAGS="-g -O2 -Wall -Werror"
+    - CFLAGS="-g -O2 -Wall -Werror -Wdeclaration-after-statement"
     - GIT_TEST_CLONE_2GB=YesPlease
     # t9810 occasionally fails on Travis CI OS X
     # t9816 occasionally fails with "TAP out of sequence errors" on Travis CI 
OS X
@@ -68,7 +68,7 @@ before_install:
     echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)";
     git-lfs version;

-before_script: make --jobs=2
+before_script: make CFLAGS="$CFLAGS" --jobs=2

 script: make --quiet test

--
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to