CTest: Fix GTM coverage parsing line offset bug

In cmParseGTMCoverage::ReadMCovFile, initialize the lineoffset variable.
Also set lastoffset only if the function is found (thanks to Bill
Hoffman).
This commit is contained in:
Zack Galbreath 2013-08-22 15:20:30 -04:00 committed by Brad King
parent 549b95f115
commit 782eba3a0c
1 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
bool found = this->FindMumpsFile(routine, filepath); bool found = this->FindMumpsFile(routine, filepath);
if(found) if(found)
{ {
int lineoffset; int lineoffset = 0;
if(this->FindFunctionInMumpsFile(filepath, if(this->FindFunctionInMumpsFile(filepath,
function, function,
lineoffset)) lineoffset))
@ -106,9 +106,9 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[filepath]; coverageVector = this->Coverage.TotalCoverage[filepath];
coverageVector[lineoffset + linenumber] += count; coverageVector[lineoffset + linenumber] += count;
}
lastoffset = lineoffset; lastoffset = lineoffset;
} }
}
else else
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,