summaryrefslogtreecommitdiff
path: root/source4/script/find_unused_function_checks.pl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-01-13 22:22:43 +0000
committerJelmer Vernooij <jelmer@samba.org>2004-01-13 22:22:43 +0000
commit17b5c26819252c01fab506887b0442f081a029f3 (patch)
tree2fe9d0e353f74a09225e18404a3073b492aa3884 /source4/script/find_unused_function_checks.pl
parentd753c5a669067d3395c4968d42263a6dca70d841 (diff)
downloadsamba-17b5c26819252c01fab506887b0442f081a029f3.tar.gz
samba-17b5c26819252c01fab506887b0442f081a029f3.tar.bz2
samba-17b5c26819252c01fab506887b0442f081a029f3.zip
Add script for finding unused function checks in configure.in
(This used to be commit 7c6a261871d2b44fe6eccfda7cb4f3c558dbf5e3)
Diffstat (limited to 'source4/script/find_unused_function_checks.pl')
-rwxr-xr-xsource4/script/find_unused_function_checks.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/script/find_unused_function_checks.pl b/source4/script/find_unused_function_checks.pl
new file mode 100755
index 0000000000..4704e907f8
--- /dev/null
+++ b/source4/script/find_unused_function_checks.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+# Arguments:
+# 1: configure.in
+# 2: C files
+#
+# You might want to specify configure.in again in the list of header files
+# as well, because it also uses some includes.
+# Note that this script does not process any includes, so you might
+# have to run "cat configure.in */config.m4 > foo.in" first.
+
+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_CHECK_FUNCS\(([\[]*)(.*)([\]]*)\)/) {
+ @hs = split / /, $2;
+ foreach(@hs) {
+ if($symbols{$_} != 1) { print "$_\n"; }
+ }
+ }
+}
+
+close IN;