Skip to content

Commit 70a44f8

Browse files
committed
Exception filter bug fix - see #279
Signed-off-by: Henry Cox <[email protected]>
1 parent 6414c2b commit 70a44f8

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/lcovutil.pm

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4215,18 +4215,20 @@ sub removeExceptionBranches
42154215
push(@replace, $br);
42164216
}
42174217
}
4218-
if (0 == scalar(@replace)) {
4219-
lcovutil::info(2, "$line: remove exception block $block_id\n");
4220-
4221-
$blockData->removeBlock($block_id, $brdata);
4222-
} else {
4218+
# If there is only one branch left - then this is not a conditional
4219+
# perhaps that should be a separate 'orphan' filter
4220+
if (2 > scalar(@replace)) {
4221+
lcovutil::info(2,
4222+
"$line: remove " .
4223+
(1 == scalar(@replace) ? 'orphan ' : '') .
4224+
"exception block $block_id\n");
4225+
$brdata->removeBlock($block_id, $self);
4226+
} elsif ($modified) {
42234227
@$blockData = @replace;
42244228
}
42254229
}
4226-
# If there is only one branch left - then this is not a conditional
4227-
if (2 > scalar($brdata->blocks())) {
4228-
lcovutil::info(2, "$line: lone block\n")
4229-
if 1 == scalar($brdata->blocks());
4230+
if (0 == scalar($brdata->blocks())) {
4231+
lcovutil::info(2, "$line: no branches remain\n");
42304232
$self->remove($line);
42314233
$modified = 1;
42324234
}
@@ -5719,7 +5721,7 @@ sub _deriveFunctionEndLines
57195721
} else {
57205722
my $suffix = lcovutil::explain_once('derive_end_line',
57215723
" See lcovrc man entry for 'derive_function_end_line'."
5722-
);
5724+
);
57235725
lcovutil::ignorable_error(
57245726
$lcovutil::ERROR_INCONSISTENT_DATA,
57255727
'"' . $traceInfo->filenname() .

0 commit comments

Comments
 (0)