This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Typo fix in pod/perl5110delta.pod
[perl5.git] / Porting / checkARGS_ASSERT.pl
1 #!/usr/bin/perl -w
2 use strict;
3
4 # Print out any PERL_ARGS_ASSERT* macro that was declared but not used.
5
6 my %declared;
7 my %used;
8
9 open my $fh, '<', 'proto.h' or die "Can't open proto.h: $!";
10 while (<$fh>) {
11     $declared{$1}++ if /^#define\s+(PERL_ARGS_ASSERT[A-Za-z_]+)\s+/;
12 }
13
14 if (!@ARGV) {
15     open my $fh, '<', 'MANIFEST' or die "Can't open MANIFEST: $!";
16     while (<$fh>) {
17         # *.c or */*.c
18         push @ARGV, $1 if m!^((?:[^/]+/)?[^/]+\.c)\t!;
19     }
20 }
21
22 while (<>) {
23     $used{$1}++ if /^\s+(PERL_ARGS_ASSERT_[A-Za-z_]+);$/;
24 }
25
26 my %unused;
27
28 foreach (keys %declared) {
29     $unused{$_}++ unless $used{$_};
30 }
31
32 print $_, "\n" foreach sort keys %unused;