Package: lcov
Version: 1.9
Severity: normal
Tags: patch upstream

gcc 4.7 (at least, that version is the first time this is mentioned in
the manual) changed the 'gcov' output format slightly to allow it to
distinguish unexecuted lines which are "reachable ... only [by]
exceptional paths such as C++ exception handlers."  These are marked
with "=====" instead of "#####".  The attached patch makes lcov's
geninfo treat these as zero-execution-count lines; without it,
processing C++ with catch clauses you get a flood of

geninfo: Argument "=====" isn't numeric in numeric gt (>) at
/usr/bin/geninfo line 1281.

error messages, and unexecuted catch clauses are reported as not
having any generated code at all (so your coverage is artificially
high).  I didn't bother checking for gcc 4.7 specifically in the
parser; in fact, I made the pre-gcc-3.3 parser handle "======" too,
because it's quite possible that this feature has always been there
and just never got mentioned in the manual until 4.7.

Note that I have already informed [email protected]
about this bug.  There does not appear to be an upstream bug tracker
that I can find.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lcov depends on:
ii  gcc   4:4.7.2-1
ii  perl  5.14.2-17

Versions of packages lcov recommends:
ii  libgd-gd2-perl  1:2.46-3+b1

lcov suggests no packages.

-- no debconf information
Description: Handle "=====" as another form of zero.
 gcov prints "=====" instead of "######" when an unexecuted line is
 "reachable only by exceptional paths such as C++ exception handlers."
 This should be handled the same as "######" for our purposes.
Author: Zack Weinberg <[email protected]>
Last-Update: 2013-02-01

--- lcov-1.10.orig/bin/geninfo
+++ lcov-1.10/bin/geninfo
@@ -1742,8 +1742,9 @@ sub read_gcov_file($)
 				$number = (split(" ",substr($_, 0, 16)))[0];
 
 				# Check for zero count which is indicated
-				# by ######
-				if ($number eq "######") { $number = 0;	}
+				# by ###### or ======
+				if ($number eq "######" or
+				    $number eq "======") { $number = 0; }
 
 				if ($exclude_line) {
 					# Register uninstrumented line instead
@@ -1833,7 +1834,8 @@ sub read_gcov_file($)
 						push(@result, 0);
 					} else {
 						# Check for zero count
-						if ($count eq "#####") {
+						if ($count eq "#####" ||
+                                                    $count eq "=====") {
 							$count = 0;
 						}
 						push(@result, 1);

Reply via email to