git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] travis-ci: override CFLAGS properly, add -Wdeclaration-after-statement
@ 2016-02-08  8:59 larsxschneider
  2016-02-08 12:25 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: larsxschneider @ 2016-02-08  8:59 UTC (permalink / raw)
  To: git; +Cc: peff, Lars Schneider

From: Lars Schneider <larsxschneider@gmail.com>

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

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-09 23:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-08  8:59 [PATCH v1] travis-ci: override CFLAGS properly, add -Wdeclaration-after-statement larsxschneider
2016-02-08 12:25 ` Jeff King
2016-02-09 10:06   ` Lars Schneider
2016-02-09 17:36     ` Jeff King
2016-02-09 17:47       ` Junio C Hamano
2016-02-09 20:51         ` Ramsay Jones
2016-02-09 18:42     ` Junio C Hamano
2016-02-09 18:46       ` Stefan Beller
2016-02-09 23:03       ` Roberto Tyley
2016-02-09 23:14         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).