summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-05-30 19:37:46 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-01 18:19:51 (GMT)
commit8b6f439ef20cf882b4f3deba48f34a01a98963d9 (patch)
tree9e42c3ee7dcbfc7f3d99af79a982735339993af5 /Source/CTest
parent389ed56f63653e89b3d640cf7aebdc8ebe7ca643 (diff)
downloadCMake-8b6f439ef20cf882b4f3deba48f34a01a98963d9.zip
CMake-8b6f439ef20cf882b4f3deba48f34a01a98963d9.tar.gz
CMake-8b6f439ef20cf882b4f3deba48f34a01a98963d9.tar.bz2
Access string npos without instance
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx13
-rw-r--r--Source/CTest/cmCTestGIT.cxx4
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx3
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx12
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx34
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx78
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx4
10 files changed, 80 insertions, 78 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index b6075c9..18ef05c 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -596,10 +596,10 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
cmSystemTools::ConvertToUnixSlashes(cm->SourceFile);
- if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) {
+ if (cm->SourceFile.find("/.../") != std::string::npos) {
cmSystemTools::ReplaceString(cm->SourceFile, "/.../", "");
std::string::size_type p = cm->SourceFile.find('/');
- if (p != cm->SourceFile.npos) {
+ if (p != std::string::npos) {
cm->SourceFile =
cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p);
}
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 87c532c..877cd24 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -103,6 +103,7 @@ public:
return this->PipeState;
}
int GetProcessState() { return this->PipeState; }
+
private:
int PipeState;
cmsysProcess* Process;
@@ -896,7 +897,7 @@ int cmCTestCoverageHandler::HandleBlanketJSCoverage(
cmsys::ifstream in(files[fileEntry].c_str());
cmSystemTools::GetLineFromStream(in, line);
cmSystemTools::GetLineFromStream(in, line);
- if (line.find("node-jscoverage") != line.npos) {
+ if (line.find("node-jscoverage") != std::string::npos) {
blanketFiles.push_back(files[fileEntry]);
}
}
@@ -1222,7 +1223,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -1524,7 +1525,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
if (vec[lineIdx] < 0) {
- if (cov > 0 || prefix.find('#') != prefix.npos) {
+ if (cov > 0 || prefix.find('#') != std::string::npos) {
vec[lineIdx] = 0;
}
}
@@ -2127,7 +2128,7 @@ bool cmCTestCoverageHandler::GetNextInt(std::string const& inputLine,
std::string::size_type start = pos;
pos = inputLine.find(',', start);
value = atoi(inputLine.substr(start, pos).c_str());
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
return true;
}
pos++;
@@ -2141,7 +2142,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
{
// find the first comma
std::string::size_type pos = inputLine.find(',');
- if (pos == inputLine.npos) {
+ if (pos == std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error parsing string : " << inputLine << "\n");
return false;
@@ -2168,7 +2169,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine(
return false;
}
// should be at the end now
- if (pos != inputLine.npos) {
+ if (pos != std::string::npos) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : "
<< inputLine << " last pos not npos = " << pos << "\n");
}
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 17f822d..230aedf 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -191,9 +191,9 @@ bool cmCTestGIT::UpdateByFetchAndReset()
std::string line;
while (sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) {
this->Log << "FETCH_HEAD> " << line << "\n";
- if (line.find("\tnot-for-merge\t") == line.npos) {
+ if (line.find("\tnot-for-merge\t") == std::string::npos) {
std::string::size_type pos = line.find('\t');
- if (pos != line.npos) {
+ if (pos != std::string::npos) {
sha1 = line.substr(0, pos);
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index fc4980b..c35f0bc 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -801,7 +801,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
bool unlimitedOutput = false;
- if (str.find("CTEST_FULL_OUTPUT") != str.npos ||
+ if (str.find("CTEST_FULL_OUTPUT") != std::string::npos ||
this->CustomMaximumFailedTestOutputSize == 0) {
unlimitedOutput = true;
}
@@ -953,7 +953,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
std::string& theLine = lines[cc];
// check for command line arguments that are not escaped
// correctly by BC
- if (theLine.find("TargetArgs=") != theLine.npos) {
+ if (theLine.find("TargetArgs=") != std::string::npos) {
// skip this because BC gets it wrong and we can't parse it
} else if (!parser.ParseChunk(theLine.c_str(), theLine.size())) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index fe23075..0c4269e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -596,8 +596,7 @@ void cmCTestRunTest::ComputeArguments()
void cmCTestRunTest::DartProcessing()
{
if (!this->ProcessOutput.empty() &&
- this->ProcessOutput.find("<DartMeasurement") !=
- this->ProcessOutput.npos) {
+ this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
// keep searching and replacing until none are left
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 4aceddb..8d62fa1 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -595,7 +595,7 @@ void cmCTestSubmitHandler::ParseResponse(
std::string output;
output.append(chunk.begin(), chunk.end());
- if (output.find("<cdash") != output.npos) {
+ if (output.find("<cdash") != std::string::npos) {
ResponseParser parser;
parser.Parse(output.c_str());
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index da3ae2f..674be60 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -225,7 +225,7 @@ public:
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
- */
+ */
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
@@ -247,7 +247,7 @@ inline int GetNextNumber(std::string const& in, int& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -273,7 +273,7 @@ inline int GetNextRealNumber(std::string const& in, double& val,
std::string::size_type& pos2)
{
pos2 = in.find(',', pos);
- if (pos2 != in.npos) {
+ if (pos2 != std::string::npos) {
if (pos2 - pos == 0) {
val = -1;
} else {
@@ -1823,7 +1823,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
std::string::size_type pos;
while (cmSystemTools::GetLineFromStream(ifs, line)) {
pos = line.find(':', 0);
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
continue;
}
@@ -2027,7 +2027,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length)
{
if (!length || length >= output.size() ||
- output.find("CTEST_FULL_OUTPUT") != output.npos) {
+ output.find("CTEST_FULL_OUTPUT") != std::string::npos) {
return true;
}
@@ -2175,7 +2175,7 @@ bool cmCTestTestHandler::SetTestsProperties(
}
if (key == "MEASUREMENT") {
size_t pos = val.find_first_of('=');
- if (pos != val.npos) {
+ if (pos != std::string::npos) {
std::string mKey = val.substr(0, pos);
const char* mVal = val.c_str() + pos + 1;
rtit->Measurements[mKey] = mVal;
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index e5d8a23..f7f3e41 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -35,7 +35,7 @@ public:
line.substr(begIndex + 3, endIndex - (begIndex + 4));
return foundFileName;
}
- return line.substr(begIndex, line.npos);
+ return line.substr(begIndex, std::string::npos);
}
bool ParseFile(std::string const& file)
{
@@ -51,13 +51,13 @@ public:
return false;
}
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("filename") != line.npos) {
+ if (line.find("filename") != std::string::npos) {
if (foundFile) {
/*
- * Upon finding a second file name, generate a
- * vector within the total coverage to capture the
- * information in the local vector
- */
+ * Upon finding a second file name, generate a
+ * vector within the total coverage to capture the
+ * information in the local vector
+ */
FileLinesType& CoverageVector =
this->Coverage.TotalCoverage[filename];
CoverageVector = localCoverageVector;
@@ -66,19 +66,19 @@ public:
foundFile = true;
inSource = false;
filename = getValue(line, 0);
- } else if ((line.find("coverage") != line.npos) && foundFile &&
+ } else if ((line.find("coverage") != std::string::npos) && foundFile &&
inSource) {
/*
- * two types of "coverage" in the JSON structure
- *
- * The coverage result over the file or set of files
- * and the coverage for each individual line
- *
- * FoundFile and foundSource ensure that
- * only the value of the line coverage is captured
- */
+ * two types of "coverage" in the JSON structure
+ *
+ * The coverage result over the file or set of files
+ * and the coverage for each individual line
+ *
+ * FoundFile and foundSource ensure that
+ * only the value of the line coverage is captured
+ */
std::string result = getValue(line, 1);
- result = result.substr(2, result.npos);
+ result = result.substr(2, std::string::npos);
if (result == "\"\"") {
// Empty quotation marks indicate that the
// line is not executable
@@ -87,7 +87,7 @@ public:
// Else, it contains the number of time executed
localCoverageVector.push_back(atoi(result.c_str()));
}
- } else if (line.find("source") != line.npos) {
+ } else if (line.find("source") != std::string::npos) {
inSource = true;
}
}
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index 9cdd50b..4b781a6 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -42,18 +42,20 @@ public:
size_t beginPos = line.find("begin");
// Check that the begin is the first non-space string on the line
- if ((beginPos == line.find_first_not_of(' ')) && beginPos != line.npos) {
+ if ((beginPos == line.find_first_not_of(' ')) &&
+ beginPos != std::string::npos) {
beginSet.push_back("begin");
coverageVector.push_back(-1);
continue;
}
- if (line.find('{') != line.npos) {
+ if (line.find('{') != std::string::npos) {
blockComFlag = true;
- } else if (line.find('}') != line.npos) {
+ } else if (line.find('}') != std::string::npos) {
blockComFlag = false;
coverageVector.push_back(-1);
continue;
- } else if ((line.find("end;") != line.npos) && !beginSet.empty()) {
+ } else if ((line.find("end;") != std::string::npos) &&
+ !beginSet.empty()) {
beginSet.pop_back();
coverageVector.push_back(-1);
continue;
@@ -62,7 +64,7 @@ public:
// This checks for comments after lines of code, finding the
// comment symbol after the ending semicolon.
comPos = line.find("//");
- if (comPos != line.npos) {
+ if (comPos != std::string::npos) {
semiPos = line.find(';');
if (comPos < semiPos) {
lineComFlag = true;
@@ -91,20 +93,20 @@ public:
size_t pos = 0;
/*
- * This first 'while' section goes through the found HTML
- * file name and attempts to capture the source file name
- * which is set as part of the HTML file name: the name of
- * the file is found in parenthesis '()'
- *
- * See test HTML file name: UTCovTest(UTCovTest.pas).html.
- *
- * Find the text inside each pair of parenthesis and check
- * to see if it ends in '.pas'. If it can't be found,
- * exit the function.
- */
+ * This first 'while' section goes through the found HTML
+ * file name and attempts to capture the source file name
+ * which is set as part of the HTML file name: the name of
+ * the file is found in parenthesis '()'
+ *
+ * See test HTML file name: UTCovTest(UTCovTest.pas).html.
+ *
+ * Find the text inside each pair of parenthesis and check
+ * to see if it ends in '.pas'. If it can't be found,
+ * exit the function.
+ */
while (true) {
lastoffset = line.find('(', pos);
- if (lastoffset == line.npos) {
+ if (lastoffset == std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, endnamepos
<< "File not found " << lastoffset << std::endl,
this->Coverage.Quiet);
@@ -112,7 +114,7 @@ public:
}
endnamepos = line.find(')', lastoffset);
filename = line.substr(lastoffset + 1, (endnamepos - 1) - lastoffset);
- if (filename.find(".pas") != filename.npos) {
+ if (filename.find(".pas") != std::string::npos) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Coverage found for file: " << filename
<< std::endl,
@@ -122,9 +124,9 @@ public:
pos = lastoffset + 1;
}
/*
- * Glob through the source directory for the
- * file found above
- */
+ * Glob through the source directory for the
+ * file found above
+ */
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
@@ -133,9 +135,9 @@ public:
std::vector<std::string> const& files = gl.GetFiles();
if (files.empty()) {
/*
- * If that doesn't find any matching files
- * return a failure.
- */
+ * If that doesn't find any matching files
+ * return a failure.
+ */
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Unable to find file matching" << glob << std::endl,
this->Coverage.Quiet);
@@ -144,9 +146,9 @@ public:
FileLinesType& coverageVector = this->Coverage.TotalCoverage[files[0]];
/*
- * Initialize the file to have all code between 'begin' and
- * 'end' tags marked as executable
- */
+ * Initialize the file to have all code between 'begin' and
+ * 'end' tags marked as executable
+ */
this->initializeDelphiFile(files[0], coverageVector);
@@ -156,19 +158,19 @@ public:
}
/*
- * Now read the HTML file, looking for the lines that have an
- * "inline" in it. Then parse out the "class" value of that
- * line to determine if the line is executed or not.
- *
- * Sample HTML line:
- *
- * <tr class="covered"><td>47</td><td><pre style="display:inline;">
- * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
- *
- */
+ * Now read the HTML file, looking for the lines that have an
+ * "inline" in it. Then parse out the "class" value of that
+ * line to determine if the line is executed or not.
+ *
+ * Sample HTML line:
+ *
+ * <tr class="covered"><td>47</td><td><pre style="display:inline;">
+ * &nbsp;CheckEquals(1,2-1);</pre></td></tr>
+ *
+ */
while (cmSystemTools::GetLineFromStream(in, line)) {
- if (line.find("inline") == line.npos) {
+ if (line.find("inline") == std::string::npos) {
continue;
}
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 15ef059..e4ee699 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -56,7 +56,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
int lastoffset = 0;
while (cmSystemTools::GetLineFromStream(in, line)) {
// only look at lines that have coverage data
- if (line.find("^ZZCOVERAGE") == line.npos) {
+ if (line.find("^ZZCOVERAGE") == std::string::npos) {
continue;
}
std::string filepath;
@@ -199,7 +199,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
// now parse the right hand side of the =
pos = line.find('=');
// no = found, this is an error
- if (pos == line.npos) {
+ if (pos == std::string::npos) {
return false;
}
pos++; // move past =