diff options
| author | Ramsay Jones <ramsay@ramsay1.demon.co.uk> | 2014-10-11 20:57:25 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2014-11-10 11:57:43 +0800 |
| commit | 13a3e97e26f14e2632ebfaed04abd0f68a28b6f2 (patch) | |
| tree | f73b3fe35dd5e8861386cc5788f511a46843e3f8 | |
| parent | 307a9806e9db1121d763db4214e16835cd7ea34b (diff) | |
| download | sparse-dev-13a3e97e26f14e2632ebfaed04abd0f68a28b6f2.tar.gz | |
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>
| -rwxr-xr-x | cgcc | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -83,7 +83,7 @@ if ($do_check) { print "$check\n" if $verbose; if ($do_compile) { - system ($check) == 0 or die; + system ($check) == 0 or exit 1; } else { exec ($check); } @@ -101,7 +101,7 @@ exit 0; sub check_only_option { my ($arg) = @_; - return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sign|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undef|ptr-subtraction-blows|cast-to-as|decl|transparent-union|address-space|enum-mismatch|do-while|old-initializer|non-pointer-null|paren-string|return-void|designated-init|sparse-all)$/; + return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sign|one-bit-signed-bitfield|cast-truncate|bitwise|typesign|context|undef|ptr-subtraction-blows|cast-to-as|decl|transparent-union|address-space|enum-mismatch|do-while|old-initializer|non-pointer-null|paren-string|return-void|designated-init|sparse-all|sparse-error)$/; return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/; return 0; } |
