From d9aa5b15d3bdeb2229b07ccba33cbae55d63f353 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Aug 2003 02:24:33 +0000 Subject: Add script that detects useless AC_DEFINE()'s in configure.in (This used to be commit 37f55d8619b110d217ec826bcf2773849ed0f7f7) --- source4/script/find_unused_defines.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 source4/script/find_unused_defines.pl (limited to 'source4/script') 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() { + while(/([A-Za-z0-9_]+)/sgm) { + $symbols{$1} = 1; + } + } + close FI; +} + +open(IN, $in) or die("Can't open $in"); + +while() { + if(/AC_DEFINE\(([^,]+),/ and $symbols{$1} != 1) { print "$1\n"; } +} + +close IN; -- cgit