aboutsummaryrefslogtreecommitdiff
path: root/cgcc
diff options
context:
space:
mode:
authorwelinder@troll.com <welinder@troll.com>2004-10-06 10:11:56 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:03:30 -0700
commitd5b45cace4f86a7a560897a80d9aaab0966cd2b9 (patch)
treee917d4630ddb11c6e1b05b56a29d001b15d7758d /cgcc
parentIntroduce the notion of "reserved" identifiers. (diff)
downloadsparse-d5b45cace4f86a7a560897a80d9aaab0966cd2b9.tar.gz
sparse-d5b45cace4f86a7a560897a80d9aaab0966cd2b9.tar.bz2
sparse-d5b45cace4f86a7a560897a80d9aaab0966cd2b9.zip
Add -no-compile
Diffstat (limited to 'cgcc')
-rw-r--r--cgcc53
1 files changed, 33 insertions, 20 deletions
diff --git a/cgcc b/cgcc
index a87d774..0c3e621 100644
--- a/cgcc
+++ b/cgcc
@@ -5,17 +5,27 @@ my $cc = $ENV{'REAL_CC'} || 'cc';
my $check = $ENV{'CHECK'} || 'check';
my $m64 = 0;
-my $seen_a_c_file = 0;
my $has_specs = 0;
+my $do_check = 0;
+my $do_compile = 1;
+
foreach (@ARGV) {
# Look for a .c file. We don't want to run the checker on .o or .so files
# in the link run. (This simplistic check knows nothing about options
# with arguments, but it seems to do the job.)
- $seen_a_c_file = 1 if /^[^-].*\.c$/;
+ $do_check = 1 if /^[^-].*\.c$/;
+
$m64 = 1 if /^-m64$/;
+
if (/^-specs=(.*)$/) {
$check .= &add_specs ($1);
$has_specs = 1;
+ next;
+ }
+
+ if (/^-no-compile$/) {
+ $do_compile = 0;
+ next;
}
my $this_arg = ' ' . &quote_arg ($_);
@@ -23,27 +33,31 @@ foreach (@ARGV) {
$check .= $this_arg;
}
-my $arch = `uname -m`;
-chomp $arch;
-if ($arch =~ /^(i.?86|athlon)$/) {
- $check .= &integer_types (8, 16, 32, $m64 ? 64 : 32, 64);
- $check .= &float_types (1, 1, 21, [24,8], [53,11], [64,15]);
-} elsif ($arch =~ /^(sun4u)$/) {
- $check .= &integer_types (8, 16, 32, $m64 ? 64 : 32, 64);
- $check .= &float_types (1, 1, 33, [24,8], [53,11], [113,15]);
-}
+if ($do_check) {
+ my $arch = `uname -m`;
+ chomp $arch;
+ if ($arch =~ /^(i.?86|athlon)$/) {
+ $check .= &integer_types (8, 16, 32, $m64 ? 64 : 32, 64);
+ $check .= &float_types (1, 1, 21, [24,8], [53,11], [64,15]);
+ } elsif ($arch =~ /^(sun4u)$/) {
+ $check .= &integer_types (8, 16, 32, $m64 ? 64 : 32, 64);
+ $check .= &float_types (1, 1, 33, [24,8], [53,11], [113,15]);
+ }
+
+ if (!$has_specs) {
+ my $os = `uname -s`;
+ chomp $os;
+ $check .= &add_specs (lc $os);
+ }
-if (!$has_specs) {
- my $os = `uname -s`;
- chomp $os;
- $check .= &add_specs (lc $os);
+# print "$check\n";
+# exit 1;
}
-# print "$check\n";
-# exit 1;
-system ($check) if $seen_a_c_file;
-exec ($cc);
+system ($check) if $do_check;
+exec ($cc) if $do_compile;
+exit 0;
# -----------------------------------------------------------------------------
# Check if an option is for "check" only.
@@ -51,7 +65,6 @@ exec ($cc);
sub check_only_option {
my ($arg) = @_;
return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sig|bitwise|typesign)$/;
- return 1 if $arg =~ /^-specs=/;
return 0;
}