blob: 231f6eeb79cd6974a4bde895c6cd98b744bae82d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
my $cc = $ENV{'REAL_CC'} || 'cc';
my $check = $ENV{'CHECK'} || 'check';
my $seen_a_c_file = 0;
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/;
my $this_arg = ' ' . "e_arg ($_);
$cc .= $this_arg unless &check_only_option ($_);
$check .= $this_arg;
}
system ($check) if $seen_a_c_file;
exec ($cc);
# -----------------------------------------------------------------------------
# Check if an option is for "check" only.
sub check_only_option {
my ($arg) = @_;
return 1 if $arg =~ /^-W(no-?)?(default-bitfield-sig|bitwise|typesign)$/;
return 0;
}
# -----------------------------------------------------------------------------
# Simple arg-quoting function. Just adds backslashes when needed.
sub quote_arg {
my ($arg) = @_;
return "''" if $arg eq '';
return join ('',
map {
m|^[-a-zA-Z0-9._/,=]+$| ? $_ : "\\" . $_;
} (split (//, $arg)));
}
# -----------------------------------------------------------------------------
|