summaryrefslogtreecommitdiff
path: root/cgcc
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2009-10-11 22:47:03 +0000
committerChristopher <sparse@chrisli.org>2010-03-28 17:51:36 -0700
commitc0d5c5dcb0c673afeeafadab6bf5fdef8f904ce3 (patch)
treeee2241a231edc0e6284675169bf7b3c1263a522c /cgcc
parentHandle __builtin_ms_va_list. (diff)
downloadsparse-c0d5c5dcb0c673afeeafadab6bf5fdef8f904ce3.tar.gz
sparse-c0d5c5dcb0c673afeeafadab6bf5fdef8f904ce3.tar.bz2
sparse-c0d5c5dcb0c673afeeafadab6bf5fdef8f904ce3.zip
Rename -Wall to Wsparse-all, so it doesn't get turned on unintentionally
sparse's -Wall option turns on all sparse warnings, including those that many projects will not want; for instance, warnings that enforce particular stylistic choices, or behavior allowed by a standard but considered questionable or error-prone. Furthermore, using -Wall means accepting all future warnings sparse may start issuing, not just those intentionally turned on by default. Other compilers like GCC also use -Wall, and interpret it to mean "turn on a sensible set of warnings". Since sparse exists to emit warnings, it already defaults to emitting a sensible set of warnings. Many projects pass the same options to both sparse and the C compiler, including warning options like -Wall; this results in turning on excessive amounts of sparse warnings. cgcc already filtered out -Wall, but many projects invoke sparse directly rather than using cgcc. Remove that filter, now that -Wall does not change sparse's behavior. Projects almost certainly don't want to use the new -Wsparse-all option; they should choose the specific set of warnings they want, or just go with sparse's defaults. Also update cgcc to know about Wsparse-all and not pass it to GCC, and update a test case that unnecessarily used -Wall. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'cgcc')
-rwxr-xr-xcgcc17
1 files changed, 2 insertions, 15 deletions
diff --git a/cgcc b/cgcc
index 995cc05..8005c3c 100755
--- a/cgcc
+++ b/cgcc
@@ -51,7 +51,7 @@ while (@ARGV) {
my $this_arg = ' ' . &quote_arg ($_);
$cc .= $this_arg unless &check_only_option ($_);
- $check .= $this_arg unless &cc_only_option ($_);
+ $check .= $this_arg;
}
if ($gendeps) {
@@ -88,25 +88,12 @@ 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)$/;
+ 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|sparse-all)$/;
return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/;
return 0;
}
# -----------------------------------------------------------------------------
-# Check if an option is for "cc" only.
-
-sub cc_only_option {
- my ($arg) = @_;
- # -Wall turns on all Sparse warnings, including experimental and noisy
- # ones. Don't include it just because a project wants to pass -Wall to cc.
- # If you really want cgcc to run sparse with -Wall, use
- # CHECK="sparse -Wall".
- return 1 if $arg =~ /^-Wall$/;
- return 0;
-}
-
-# -----------------------------------------------------------------------------
# Simple arg-quoting function. Just adds backslashes when needed.
sub quote_arg {