Add a security model to LSA. Similar to the SAMR code - using
[Samba.git] / source4 / script / find_unused_macros.pl
blob8886835fa33103e3e9511f24af41911b3d2351c3
1 #!/usr/bin/perl
2 # Script that reads in C files and prints defines that are used nowhere in the
3 # code
5 # Arguments: C and H files
6 # Copyright Jelmer Vernooij <jelmer@samba.org>, GPL
8 use strict;
10 my %defined;
11 my %used;
12 my %files;
14 my $tmp;
15 while($tmp = shift) {
16 $files{$tmp} = $tmp;
17 open(FI, $tmp);
18 my $ln = 0;
19 while(<FI>) {
20 $ln++;
21 my $line = $_;
22 my $cur = "";
23 if(/^#define ([A-Za-z0-9_]+)/) {
24 $defined{$1} = "$tmp:$ln";
25 $cur = $1;
28 $_ = $line;
29 while(/([A-Za-z0-9_]+)/sgm) {
30 if($cur ne $1) { $used{$1} = "$tmp:$ln"; }
33 close FI;
36 foreach(keys %defined) {
37 if(!$used{$_}) { print "$defined{$_}: Macro `$_' is unused\n"; }