Web lists-archives.com

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





On 01/02/2019 22:40, Luc Van Oostenryck wrote:
> 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 can change that by passing '-Wsparse-error' to 'sparse':
>>
>>   $ make SPARSE_FLAGS=-Wsparse-error change-table.sp
>>       SP change-table.c
>>   change-table.h:53:24: error: dubious one-bit signed bitfield
>>   change-table.h:54:25: error: dubious one-bit signed bitfield
>>   change-table.h:55:25: error: dubious one-bit signed bitfield
>>   change-table.h:56:26: error: dubious one-bit signed bitfield
>>   Makefile:2729: recipe for target 'change-table.sp' failed
>>   make: *** [change-table.sp] Error 1
>>   $ echo $?
>>   2
>>   $ 
>>
>> Note that '-Wsparse-error' not only returns a non-zero exit code (1), but
>> it also changes a 'warning' into an 'error' (see above):
> 
> Yes, I know :(
> The fact that, by default, sparse doesn't fail on errors is wanted
> (otherwise it would break the kernel compile). But that the only way
> to return an error is to use -Wsparse-error (which is supposed to
> replace GCC's -Werror) is a real problem.

Given that I only use sparse as a checker, I actually don't mind
the current behaviour. That would be different if I was using
sparsec/sparsei etc., as a compiler, of course! ;-)

[If I were to suggest any change at all to -Wsparse-error it would
be: do not change the 'warning' to an 'error' (yes, the actual text
label of the message), exit(1) if any errors or warnings, but *if*
only warnings have been issued, then print an "treating warnings
as errors [-Wsparse-error]" message.]

ATB,
Ramsay Jones