5 die "usage: perl gatherWarnings.pl [-c] [-s ##] [-dv] [-nl] sourceFile ...\n" .
6 "\t-c = count repeated warnings\n" .
7 "\t-s = combine similar warnings that differ by no more than ## words (implies -c)\n" .
8 "\t-dv = strip debug view timestamps\n" .
9 "\t-nl = strip warning locations\n";
12 while ($ARGV[0] =~ /^-/ && $ARGV[0] ne "-")
14 if ($ARGV[0] eq "-dv")
18 elsif ($ARGV[0] eq "-nl")
22 elsif ($ARGV[0] eq "-s")
28 elsif ($ARGV[0] eq "-c")
40 usage
if (@ARGV == 0);
49 s/^\s*\d+\s+\d+\.\d+\s+\[\d+\]\s+// if ($debugView);
50 s/\S+ : WARNING:/WARNING:/ if ($noLocation);
59 foreach $compare (keys %warnings)
61 @current = split(/\s+/, $_);
62 @compare = split(/\s+/, $compare);
64 if (scalar(@current) == scalar(@compare))
84 if ($count <= $similar)
87 if ($warnings{$out} ne $warnings{$compare})
89 $warnings{$out} = $warnings{$compare};
90 delete $warnings{$compare};
101 $warnings{$_} += 1 if ($repeat == 0)
117 foreach (keys %warnings)
119 push(@warnings, sprintf("%5d %s", $warnings{$_}, $_));
122 foreach (sort numerically
@warnings)