Subject: Re: [PATCH 0/1] Using sparse in a CI job

From: SZEDER Gábor <[email-masked]>
Date: Sat, 2 Feb 2019 01:41:45 +0100

On Fri, Feb 01, 2019 at 09:01:20PM +0000, Ramsay Jones wrote:
> I suspect that the Makefile sparse target is not easy to use in a CI
> job, since the 'sparse' program (via cgcc -no-compile) does not exit
> with a non-zero value, even when issuing errors and warnings.

We had the same issue with Coccinelle in the static analysis build job
on Travis CI, which was happily succeeding even when Coccinelle
noticed undesired code patterns entering the codebase.  We've dealt
with that by looking at the patch files generated by 'make
coccicheck': if they were empty, then all is well, if they are not,
then dump their contents into the log and 'exit 1'.  See 0860a7641b
(travis-ci: fail if Coccinelle static analysis found something to
transform, 2018-07-23).

I think we could do something like that with sparse as well.

> At the moment, on Linux, the sp-out file is free from any sparse errors
> or warnings. So are next and pu:
> 
>   $ grep error sp-out
>   $ grep warning sp-out

On 'master' I get:

  $ grep error sp-out 
  $ grep warning sp-out 
  connect.c:652:40: warning: incorrect type in argument 2 (invalid types)
  pack-revindex.c:65:23: warning: memset with byte count of 262144
  unix-socket.c:83:26: warning: incorrect type in argument 2 (invalid types)
  unix-socket.c:108:23: warning: incorrect type in argument 2 (invalid types)
  daemon.c:1041:36: warning: incorrect type in argument 2 (invalid types)
  daemon.c:1184:67: warning: incorrect type in argument 2 (invalid types)
  imap-send.c:1022:42: warning: incorrect type in argument 2 (invalid types)
  credential-cache--daemon.c:180:37: warning: incorrect type in argument 2 (invalid types)
  $ sparse --version
  v0.5.0