@@ -1803,7 +1803,7 @@ sub extractFileVersion
1803
1803
1804
1804
sub checkVersionMatch
1805
1805
{
1806
- my ($filename , $me , $you ) = @_ ;
1806
+ my ($filename , $me , $you , $reason ) = @_ ;
1807
1807
1808
1808
my $match ;
1809
1809
if (@extractVersionScript ) {
@@ -1816,10 +1816,12 @@ sub checkVersionMatch
1816
1816
$match = $me eq $you ; # simple string compare
1817
1817
}
1818
1818
lcovutil::ignorable_error($ERROR_VERSION ,
1819
+ (defined ($reason ) ? ($reason . ' ' ) : ' ' ) .
1819
1820
" $filename : revision control version mismatch: " .
1820
- (defined ($me ) ? $me : ' undef' ) .
1821
- ' <- ' . (defined ($you ) ? $you : ' undef' ))
1821
+ (defined ($me ) ? $me : ' undef' ) .
1822
+ ' <- ' . (defined ($you ) ? $you : ' undef' ))
1822
1823
unless $match ;
1824
+ return $match ;
1823
1825
}
1824
1826
1825
1827
#
@@ -3828,7 +3830,7 @@ sub merge
3828
3830
$brOp = \&BranchData::difference;
3829
3831
}
3830
3832
3831
- lcovutil::checkVersionMatch($filename , $me , $you );
3833
+ lcovutil::checkVersionMatch($filename , $me , $you , ' merge ' );
3832
3834
my $changed = 0;
3833
3835
3834
3836
foreach my $name ($info -> test()-> keylist()) {
@@ -4637,6 +4639,17 @@ sub _filterFile
4637
4639
} else {
4638
4640
$srcReader -> close ();
4639
4641
}
4642
+ my $fileVersion = lcovutil::extractFileVersion($source_file )
4643
+ if $srcReader -> notEmpty();
4644
+ if (defined ($fileVersion ) &&
4645
+ defined ($traceInfo -> version())
4646
+ &&
4647
+ !lcovutil::checkVersionMatch($source_file , $traceInfo -> version(),
4648
+ $fileVersion , ' filter' )
4649
+ ) {
4650
+ lcovutil::info(1, ' skip filtering due to version mismatch\n' );
4651
+ return ($traceInfo , 0);
4652
+ }
4640
4653
4641
4654
my $modified = 0;
4642
4655
if (defined ($lcovutil::func_coverage ) &&
0 commit comments