| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
open(NEED,"<need") || die; |
| 4 |
while (<NEED>) |
| 5 |
{ |
| 6 |
if (/\b([A-Z])\b\s*_?(.*)$/) |
| 7 |
{ |
| 8 |
if ($1 ne 'U') |
| 9 |
{ |
| 10 |
$def{$2} = $1; |
| 11 |
} |
| 12 |
else |
| 13 |
{ |
| 14 |
$ref{$2} = 1; |
| 15 |
} |
| 16 |
} |
| 17 |
} |
| 18 |
close(NEED); |
| 19 |
|
| 20 |
@ARGV = <*.h>; |
| 21 |
|
| 22 |
while (<>) |
| 23 |
{ |
| 24 |
if (/(extern|EXTERN|COREXT)\s*(.*)\s(\w+)\s+_ANSI_ARGS_/) |
| 25 |
{ |
| 26 |
my $kind = $1; |
| 27 |
if (!exists($def{$3})) |
| 28 |
{ |
| 29 |
if ($kind ne 'COREXT') |
| 30 |
{ |
| 31 |
print STDERR "$ARGV:$.: $kind $3 not defined\n"; |
| 32 |
} |
| 33 |
print "$ARGV:$.: $3 not defined"; |
| 34 |
print " - but not referenced" unless (exists($ref{$3})); |
| 35 |
print "\n"; |
| 36 |
} |
| 37 |
} |
| 38 |
elsif (/(extern|EXTERN|COREXT)\s*(.*)\s(\w+)\s*;/) |
| 39 |
{ |
| 40 |
my $kind = $1; |
| 41 |
if (!exists($def{$3})) |
| 42 |
{ |
| 43 |
if ($kind ne 'COREXT') |
| 44 |
{ |
| 45 |
print STDERR "$ARGV:$.: $kind $3 not defined\n"; |
| 46 |
} |
| 47 |
print "$ARGV:$.: $3 not defined"; |
| 48 |
print " - but not referenced" unless (exists($ref{$3})); |
| 49 |
print "\n"; |
| 50 |
} |
| 51 |
} |
| 52 |
$. = 0 if (eof); |
| 53 |
} |