summaryrefslogtreecommitdiff
path: root/source4/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-12-02 10:13:18 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-12-02 10:13:18 +0000
commit8af907950f87a10b0620390cfa676a74908e54dd (patch)
tree40fce2b4ca27a8032acda9ed8739a73a5ce2344d /source4/script
parent02df116352778c2bd1fd4053e7f183215216da2f (diff)
downloadsamba-8af907950f87a10b0620390cfa676a74908e54dd.tar.gz
samba-8af907950f87a10b0620390cfa676a74908e54dd.tar.bz2
samba-8af907950f87a10b0620390cfa676a74908e54dd.zip
Add script useful for finding checks for headers that are never used
(This used to be commit 0e5fdbc01bba7f1b000587d01a128c3bdbbbe03c)
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/find_unused_header_checks.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/script/find_unused_header_checks.pl b/source4/script/find_unused_header_checks.pl
new file mode 100755
index 0000000000..3caf9da453
--- /dev/null
+++ b/source4/script/find_unused_header_checks.pl
@@ -0,0 +1,38 @@
+#!/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: header files
+#
+# You might want to specify configure.in again in the list of header files
+# as well, because it also uses some includes.
+
+my %symbols;
+
+# First, make a list of defines in configure
+$in = shift;
+
+while($tmp = shift) {
+ open(FI, $tmp);
+ while(<FI>) {
+ while(/\#([ \t]*)include <(.*)>/sgm) {
+ $symbols{$2} = 1;
+ }
+ }
+ close FI;
+}
+
+open(IN, $in) or die("Can't open $in");
+
+while(<IN>) {
+ if(/AC_CHECK_HEADERS\(([\[]*)(.*)([\]]*)\)/) {
+ @hs = split / /, $2;
+ foreach(@hs) {
+ if($symbols{$_} != 1) { print "|$_|\n"; }
+ }
+ }
+}
+
+close IN;