Skip to content

Commit 1e0df57

Browse files
committed
geninfo: Fix data collection for files containing templates
When using gcc 8, lcov/geninfo produces corrupt coverage output for source code that contains templates or other constructs that cause gcov to produce multiple versions of output for some lines and branches. This is caused by an incorrect check for duplicate output in function read_gcov_file() that is triggered when a template consists of multiple lines, or contains branches. Fix this by ensuring that duplicate lines in per-instance gcov output are correctly ignored. Only the initial occurrence of each line containing the combined coverage of all instances will be processed by geninfo. Note that for branch coverage, gcov doesn't provide a combined view and geninfo processes all branches provided. This should not be a problem though as genhtml will combine the branch data when generating HTML output. Signed-off-by: Peter Oberparleiter <[email protected]>
1 parent abd8bed commit 1e0df57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/geninfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ sub read_gcov_file($)
19361936
my ($count, $line, $code) = ($1, $2, $3);
19371937

19381938
# Skip instance-specific counts
1939-
next if ($line == $last_line);
1939+
next if ($line <= (scalar(@result) / 3));
19401940

19411941
$last_line = $line;
19421942
$last_block = $UNNAMED_BLOCK;

0 commit comments

Comments
 (0)