summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-08-16 02:24:33 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-08-16 02:24:33 +0000
commitd9aa5b15d3bdeb2229b07ccba33cbae55d63f353 (patch)
tree477ab61af8525839ffeb5c2b78cbf41e51282546
parent4809559c6450d0768a6b03681098286e3d5294da (diff)
downloadsamba-d9aa5b15d3bdeb2229b07ccba33cbae55d63f353.tar.gz
samba-d9aa5b15d3bdeb2229b07ccba33cbae55d63f353.tar.bz2
samba-d9aa5b15d3bdeb2229b07ccba33cbae55d63f353.zip
Add script that detects useless AC_DEFINE()'s in configure.in
(This used to be commit 37f55d8619b110d217ec826bcf2773849ed0f7f7)
-rwxr-xr-xsource4/script/find_unused_defines.pl30
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;