blob: 3d8e2fc76f8e14c7bd8623baf24ee2c6d96007f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/perl -w
use strict;
# Print out any PERL_ARGS_ASSERT* macro that was declared but not used.
my %declared;
my %used;
open my $fh, '<', 'proto.h' or die "Can't open proto.h: $!";
while (<$fh>) {
$declared{$1}++ if /^#define\s+(PERL_ARGS_ASSERT[A-Za-z_]+)\s+/;
}
if (!@ARGV) {
open my $fh, '<', 'MANIFEST' or die "Can't open MANIFEST: $!";
while (<$fh>) {
# *.c or */*.c
push @ARGV, $1 if m!^((?:[^/]+/)?[^/]+\.c)\t!;
}
}
while (<>) {
$used{$1}++ if /^\s+(PERL_ARGS_ASSERT_[A-Za-z_]+);$/;
}
my %unused;
foreach (keys %declared) {
$unused{$_}++ unless $used{$_};
}
print $_, "\n" foreach sort keys %unused;
|