summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-19 11:04:18 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-19 11:04:18 +0200
commit87afa77eac72b84bccd292cba53ebec85dfd120c (patch)
tree1e5bd29be4a16f7b845290cc32c52c5b52920668
parent714669f17239230e325cb90ce57ce34f75f9461f (diff)
downloadsamba-87afa77eac72b84bccd292cba53ebec85dfd120c.tar.gz
samba-87afa77eac72b84bccd292cba53ebec85dfd120c.tar.bz2
samba-87afa77eac72b84bccd292cba53ebec85dfd120c.zip
find_unused_makefilevars: Support parsing simple includes.
-rwxr-xr-xsource4/script/find_unused_makefilevars.pl27
1 files changed, 18 insertions, 9 deletions
diff --git a/source4/script/find_unused_makefilevars.pl b/source4/script/find_unused_makefilevars.pl
index 1bed1228ec..23fc36ef6a 100755
--- a/source4/script/find_unused_makefilevars.pl
+++ b/source4/script/find_unused_makefilevars.pl
@@ -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) {