diff options
-rwxr-xr-x | source4/script/find_unused_defines.pl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/script/find_unused_defines.pl b/source4/script/find_unused_defines.pl new file mode 100755 index 0000000000..def1bd159f --- /dev/null +++ b/source4/script/find_unused_defines.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# Script that reads in configure and outputs the names of all the defines +# it defines that are used nowhere in the code + +# Arguments: +# 1: configure.in +# 2: C files pattern + +my %symbols; + +# First, make a list of defines in configure +$in = shift; + +while($tmp = shift) { + open(FI, $tmp); + while(<FI>) { + while(/([A-Za-z0-9_]+)/sgm) { + $symbols{$1} = 1; + } + } + close FI; +} + +open(IN, $in) or die("Can't open $in"); + +while(<IN>) { + if(/AC_DEFINE\(([^,]+),/ and $symbols{$1} != 1) { print "$1\n"; } +} + +close IN; |