Couple of minor fixes:
- don't keel over if run on an empty file
- abort if the "summary:" line is missing; previously it gave a warning
and tried to keep going but then other things broke.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1572 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in
index 36c2b9f..1092ba4 100644
--- a/cachegrind/cg_annotate.in
+++ b/cachegrind/cg_annotate.in
@@ -299,12 +299,7 @@
# Read "desc:" lines.
my $line;
- # This gives a "uninitialized value in substitution (s///)" warning; hmm...
- #while ($line = <INPUTFILE> && $line =~ s/desc:\s+//) {
- # $desc .= "$line\n";
- #}
- while (1) {
- $line = <INPUTFILE>;
+ while ($line = <INPUTFILE>) {
if ($line =~ s/desc:\s+//) {
$desc .= $line;
} else {
@@ -320,7 +315,8 @@
# Read "events:" line. We make a temporary hash in which the Nth event's
# value is N, which is useful for handling --show/--sort options below.
$line = <INPUTFILE>;
- ($line =~ s/events:\s+//) or die("Line $.: missing events line\n");
+ (defined $line && $line =~ s/events:\s+//)
+ or die("Line $.: missing events line\n");
@events = split(/\s+/, $line);
my %events;
my $n = 0;
@@ -445,7 +441,7 @@
# Check if summary line was present
if (not defined $summary_CC) {
- warn("WARNING: missing final summary line, no summary will be printed\n");
+ die("missing final summary line, aborting\n");
}
close(INPUTFILE);