On 23/05/17 04:32, Junio C Hamano wrote: > Interesting. One thing that I found somewhat suboptimal is that we > do not get signalled by non-zero exit. Warnings don't lead to non-zero exit, but similarly to -Werror, you can provide a -Wsparse-error to turn warnings into errors: $ make builtin/worktree.sp SP builtin/worktree.c builtin/worktree.c:539:38: warning: Using plain integer as NULL pointer $ $ make SPARSE_FLAGS=-Wsparse-error builtin/worktree.sp SP builtin/worktree.c builtin/worktree.c:539:38: error: Using plain integer as NULL pointer Makefile:2370: recipe for target 'builtin/worktree.sp' failed make: *** [builtin/worktree.sp] Error 1 $ Unfortunately, that does not help too much because, as I mentioned before, one warning is actually a sparse problem (and you can't turn it off): $ make pack-revindex.sp SP pack-revindex.c pack-revindex.c:64:23: warning: memset with byte count of 262144 $ This is caused by sparse _unconditionally_ complaining about the byte count used in calls to memset(), memcpy(), copy_to_user() and copy_from_user(). In addition, the byte count limits are hard-coded (v <= 0 || v > 100000). About a decade ago, I wrote a patch to enable/set the limit value from the command line, but didn't get around to sending the patch upstream. :-D [There is actually another problem warning, if you build with NO_REGEX=1]. Since cgcc was intended to be used as proxy for gcc, you might think you could use CC=cgcc on a regular build, but that has problems of it's own: $ make clean >/dev/null 2>&1 # on 'pu' branch, build output in 'pout' $ make CC=cgcc >pout1 2>&1 $ diff pout pout1 99a100 > pack-revindex.c:64:23: warning: memset with byte count of 262144 199a201 > imap-send.c:1439:9: warning: expression using sizeof on a function 200a203,207 > http.c:675:9: warning: expression using sizeof on a function > http.c:1676:25: warning: expression using sizeof on a function > http.c:1681:25: warning: expression using sizeof on a function > http.c:2082:9: warning: expression using sizeof on a function > http.c:2249:9: warning: expression using sizeof on a function 219a227 > http-walker.c:377:9: warning: expression using sizeof on a function 222a231,233 > http-push.c:189:9: warning: expression using sizeof on a function > http-push.c:200:9: warning: expression using sizeof on a function > http-push.c:202:9: warning: expression using sizeof on a function 228a240,243 > remote-curl.c:524:9: warning: expression using sizeof on a function > remote-curl.c:605:17: warning: expression using sizeof on a function > remote-curl.c:608:17: warning: expression using sizeof on a function > remote-curl.c:676:9: warning: expression using sizeof on a function 374a390 > builtin/worktree.c:539:38: warning: Using plain integer as NULL pointer ... $ See commit 9371322a60 (sparse: suppress some "using sizeof on a function" warnings, 06-10-2013) for an explanation of the additional warnings. I chose the SPARSE_FLAGS method to suppress those warnings, precisely because I don't build git that way. (git grep -n SPARSE_FLAGS). So, using CC='cgcc -Wsparse-error' as it stands isn't much help: $ make clean >/dev/null 2>&1 $ make CC='cgcc -Wsparse-error' GIT_VERSION = 2.13.0.530.g896b4ae59 * new build flags CC credential-store.o * new link flags CC common-main.o ... CC pack-objects.o CC pack-revindex.o pack-revindex.c:64:23: error: memset with byte count of 262144 Makefile:2036: recipe for target 'pack-revindex.o' failed make: *** [pack-revindex.o] Error 1 $ > Otherwise it would make a > good addition to the "Static Analysis" task in .travis.yml file. Unfortunately, some additional work required. :-P ATB, Ramsay Jones