mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
find_unused_makefilevars: Support parsing simple includes.
This commit is contained in:
parent
714669f172
commit
87afa77eac
@ -13,17 +13,26 @@ my %defines;
|
||||
# First, make a list of defines in configure
|
||||
$in = shift;
|
||||
|
||||
open(IN, $in);
|
||||
while(<IN>) {
|
||||
my $line = $_;
|
||||
while($line =~ /^\b([a-zA-Z0-9_][a-zA-Z0-9_]*)\b[ \t]*=.*/sgm) {
|
||||
$defines{$1} = 1;
|
||||
}
|
||||
while($line =~ /\$\(([a-zA-Z0-9_][a-zA-Z0-9_]*)\)/sgm) {
|
||||
$references{$1} = 1;
|
||||
sub process_file($)
|
||||
{
|
||||
my ($fn) = @_;
|
||||
open(IN, $fn);
|
||||
while(<IN>) {
|
||||
my $line = $_;
|
||||
while($line =~ /^\b([a-zA-Z0-9_][a-zA-Z0-9_]*)\b[ \t]*=.*/sgm) {
|
||||
$defines{$1} = 1;
|
||||
}
|
||||
while($line =~ /\$\(([a-zA-Z0-9_][a-zA-Z0-9_]*)\)/sgm) {
|
||||
$references{$1} = 1;
|
||||
}
|
||||
while ($line =~ /^include (.*)/sgm) {
|
||||
process_file($1);
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
}
|
||||
close IN;
|
||||
|
||||
process_file($in);
|
||||
|
||||
print "##### DEFINED BUT UNUSED: #####\n";
|
||||
foreach(%defines) {
|
||||
|
Loading…
Reference in New Issue
Block a user