cgcc: avoid passing a sparse-only option to cc

Passing the '-Wsparse-error' to cgcc can cause that option to be
passed to the C compiler (usually gcc), if the given source file
does not provoke any sparse warnings, which in turn results in
a failure to compile that file.

In order to avoid passing this sparse option to the compiler, we
add the '-Wsparse-error' option to the regular expression check
in the 'check_only_option' function.

In addition, we replace the plain call to 'die' when sparse exits
with non-zero status (maybe due to -Wsparse-error), with a simple
'exit 1'. This suppresses an 'Died at ./cgcc line 86.' message on
exit from cgcc.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Christopher Li <sparse@chrisli.org>
1 file changed