1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00
samba-mirror/source4/script/find_unused_header_checks.pl
Jelmer Vernooij 0172920e16 Add note about new configure structure.
(This used to be commit 43130f370b)
2004-01-02 13:47:13 +00:00

41 lines
866 B
Perl
Executable File

#!/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.
# 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(/\#([ \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;