-
Notifications
You must be signed in to change notification settings - Fork 1
/
dead.pl
50 lines (35 loc) · 953 Bytes
/
dead.pl
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl
=pod
=head1 NAME
dead.pl - Identify dead code and variables
=head1 SYNOPSIS
dead.pl
=head1 DESCRIPTION
The I<deal.pl> reads the I<object_xref.dat> file produced
by I<ox-gen.pl> and prints out all symbols that are not
used. These symbols indicate code that is not used or should
be made B<static>.
=head1 AUTHOR
Steve Oualline, E<lt>[email protected]<gt>.
=head1 COPYRIGHT
Copyright 2005 Steve Oualline.
This program is distributed under the GPL.
=cut
use strict;
use warnings;
use Storable;
# The cross reference data
my $object_xref = retrieve("object_xref.dat");
if (not defined($object_xref)) {
print "Could not find data file\n";
exit (8);
}
# Look through each symbol on the command line
foreach my $sym (sort keys %$object_xref) {
# Get the information about this symbol
my $info = $object_xref->{$sym};
my $used = $info->{used};
if ($#$used == -1) {
print "$sym\n";
}
}