diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-01-15 22:04:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-18 13:25:24 (GMT) |
commit | fd7b37129360364531ddfeda7edb6e34ba773d00 (patch) | |
tree | 701d9b298e1030b901a507b436e162810af3b8cc /Source/CTest | |
parent | aa773035b7f4a1aefd860d0b9e80f134bd4a4547 (diff) | |
download | CMake-fd7b37129360364531ddfeda7edb6e34ba773d00.zip CMake-fd7b37129360364531ddfeda7edb6e34ba773d00.tar.gz CMake-fd7b37129360364531ddfeda7edb6e34ba773d00.tar.bz2 |
Replace foo.size() pattern with !foo.empty().
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 12 | ||||
-rw-r--r-- | Source/CTest/cmCTestLaunch.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 24 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmParseGTMCoverage.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 2 |
13 files changed, 42 insertions, 42 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 9699d0d..d90aeb7 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -62,7 +62,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, std::vector<std::string> args; args.push_back(cmSystemTools::GetCMakeCommand()); args.push_back(this->SourceDir); - if(this->BuildGenerator.size()) + if(!this->BuildGenerator.empty()) { std::string generator = "-G"; generator += this->BuildGenerator; @@ -74,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, platform += this->BuildGeneratorPlatform; args.push_back(platform); } - if(this->BuildGeneratorToolset.size()) + if(!this->BuildGeneratorToolset.empty()) { std::string toolset = "-T"; toolset += this->BuildGeneratorToolset; @@ -212,7 +212,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::ostringstream out; if ( this->CTest->GetConfigType().empty() && - this->ConfigSample.size()) + !this->ConfigSample.empty()) { // use the config sample to set the ConfigType std::string fullPath; @@ -225,7 +225,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) resultingConfig, extraPaths, failed); - if (fullPath.size() && resultingConfig.size()) + if (!fullPath.empty() && !resultingConfig.empty()) { this->CTest->SetConfigType(resultingConfig.c_str()); } @@ -340,7 +340,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string resultingConfig; std::vector<std::string> extraPaths; // if this->ExecutableDirectory is set try that as well - if (this->ExecutableDirectory.size()) + if (!this->ExecutableDirectory.empty()) { std::string tempPath = this->ExecutableDirectory; tempPath += "/"; @@ -388,7 +388,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string outs; int retval = 0; // run the test from the this->BuildRunDir if set - if(this->BuildRunDir.size()) + if(!this->BuildRunDir.empty()) { out << "Run test in directory: " << this->BuildRunDir << "\n"; cmSystemTools::ChangeDirectory(this->BuildRunDir); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 4032499..8f087ab 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -1150,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, { // This is not an error or warning. // So, figure out if this is a post-context line - if ( this->ErrorsAndWarnings.size() && + if ( !this->ErrorsAndWarnings.empty() && this->LastErrorOrWarning != this->ErrorsAndWarnings.end() && this->PostContextCount < this->MaxPostContext ) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f821724..08b7c66 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -87,7 +87,7 @@ public: } args.push_back(0); // null terminate cmsysProcess_SetCommand(this->Process, &*args.begin()); - if(this->WorkingDirectory.size()) + if(!this->WorkingDirectory.empty()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); @@ -270,7 +270,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, std::string ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile.c_str(), checkDir.c_str()); - if ( ndc.size() ) + if (!ndc.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of " << file << std::endl); @@ -281,7 +281,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, // Get the relative path to the file an apply it to the opposite directory. // If it is the same as fileDir, then ignore, otherwise check. std::string relPath; - if(checkDir.size() ) + if(!checkDir.empty()) { relPath = cmSystemTools::RelativePath(checkDir.c_str(), fFile.c_str()); @@ -309,7 +309,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage", fFile.c_str(), checkDir.c_str()); - if ( ndc.size() ) + if (!ndc.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of: " << file << std::endl); @@ -2183,7 +2183,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( while(cmSystemTools::GetLineFromStream(fin, stdline)) { // if we have a line of output from stdout - if(stdline.size()) + if(!stdline.empty()) { // parse the comma separated output this->ParseBullsEyeCovsrcLine(stdline, @@ -2596,7 +2596,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles( } } - if(extraMatches.size()) + if(!extraMatches.empty()) { for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i = cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i) diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 77c5d57..62fa2be 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -720,7 +720,7 @@ bool cmCTestLaunch::Match(std::string const& line, //---------------------------------------------------------------------------- bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const { - if(this->OptionFilterPrefix.size() && cmSystemTools::StringStartsWith( + if(!this->OptionFilterPrefix.empty() && cmSystemTools::StringStartsWith( line.c_str(), this->OptionFilterPrefix.c_str())) { return true; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 68c5a92..d4ff24f 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -223,7 +223,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand( this->MemoryTesterEnvironmentVariable; for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) { - if(memTesterEnvironmentVariable.size()) + if(!memTesterEnvironmentVariable.empty()) { // If we are using env to pass options, append all the options to // this string with space separation. @@ -241,7 +241,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand( } // if this is an env option type, then add the env string as a single // argument. - if(memTesterEnvironmentVariable.size()) + if(!memTesterEnvironmentVariable.empty()) { std::string::size_type pos = memTesterEnvironmentVariable.find("??"); if (pos != std::string::npos) @@ -848,7 +848,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( { resultFound = sanitizerWarning.match(1); } - if(resultFound.size()) + if(!resultFound.empty()) { std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound); if(result.empty() || idx > result.size()-1) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 8da9886..f9e8a3c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -636,7 +636,7 @@ void cmCTestMultiProcessHandler::PrintTestList() testRun.SetTestProperties(&p); testRun.ComputeArguments(); //logs the command in verbose mode - if(p.Labels.size()) //print the labels + if(!p.Labels.empty()) //print the labels { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:"); } @@ -645,7 +645,7 @@ void cmCTestMultiProcessHandler::PrintTestList() { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label); } - if(p.Labels.size()) //print the labels + if(!p.Labels.empty()) //print the labels { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); } @@ -683,7 +683,7 @@ void cmCTestMultiProcessHandler::PrintLabels() allLabels.insert(p.Labels.begin(), p.Labels.end()); } - if(allLabels.size()) + if(!allLabels.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 056554e..314c8ad 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -318,7 +318,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "----------------------------------------------------------" << std::endl; - if(this->TestResult.Reason.size()) + if(!this->TestResult.Reason.empty()) { *this->TestHandler->LogFile << reasonType << ":\n" << this->TestResult.Reason << "\n"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 71edd5b..8184bb4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -415,7 +415,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->UpdateElapsedTime(); // add the script arg if defined - if (script_arg.size()) + if (!script_arg.empty()) { this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str()); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 2ed4b57..bc6fb31 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -61,7 +61,7 @@ private: std::string GetCurrentValue() { std::string val; - if(this->CurrentValue.size()) + if(!this->CurrentValue.empty()) { val.assign(&this->CurrentValue[0], this->CurrentValue.size()); } @@ -301,7 +301,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, << error_buffer << std::endl << " Curl output was: "; // avoid dereference of empty vector - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size()); cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: [" @@ -605,7 +605,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, << " Error message was: " << error_buffer << std::endl; // avoid deref of begin for zero size array - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << " Curl output was: " << cmCTestLogWrite(&*chunk.begin(), chunk.size()) @@ -766,7 +766,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( << std::endl << " Error message was: " << error_buffer << std::endl; - if(chunk.size()) + if(!chunk.empty()) { *this->LogFile << " Curl output was: " @@ -1060,7 +1060,7 @@ int cmCTestSubmitHandler::ProcessHandler() { std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash"); // cdash does not need to trigger so just return true - if(iscdash.size()) + if(!iscdash.empty()) { this->CDash = true; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2896a50..925e3c9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -564,7 +564,7 @@ int cmCTestTestHandler::ProcessHandler() } else { - if (this->HandlerVerbose && passed.size() && + if (this->HandlerVerbose && !passed.empty() && (this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag)) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl @@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler() cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = " << realBuf << "\n" ); - if (failed.size()) + if (!failed.empty()) { cmGeneratedFileStream ofs; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl @@ -698,7 +698,7 @@ void cmCTestTestHandler::PrintLabelSummary() } } // now print times - if(labels.size()) + if(!labels.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); } @@ -717,7 +717,7 @@ void cmCTestTestHandler::PrintLabelSummary() << buf << "\n"; } } - if(labels.size()) + if(!labels.empty()) { if(this->LogFile) { @@ -850,7 +850,7 @@ void cmCTestTestHandler::ComputeTestList() if (this->UseUnion) { // if it is not in the list and not in the regexp then skip - if ((this->TestsToRun.size() && + if ((!this->TestsToRun.empty() && std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) == this->TestsToRun.end()) && !it->IsInBasedOnREOptions) { @@ -860,7 +860,7 @@ void cmCTestTestHandler::ComputeTestList() else { // is this test in the list of tests to run? If not then skip it - if ((this->TestsToRun.size() && + if ((!this->TestsToRun.empty() && std::find(this->TestsToRun.begin(), this->TestsToRun.end(), inREcnt) == this->TestsToRun.end()) || !it->IsInBasedOnREOptions) @@ -891,7 +891,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed() cnt ++; // if this test is not in our list of tests to run, then skip it. - if ((this->TestsToRun.size() && + if ((!this->TestsToRun.empty() && std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) == this->TestsToRun.end())) { @@ -1094,7 +1094,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed, p.Timeout = this->CTest->GetGlobalTimeout(); } - if(p.Depends.size()) + if(!p.Depends.empty()) { for(std::vector<std::string>::iterator i = p.Depends.begin(); i != p.Depends.end(); ++i) @@ -1192,7 +1192,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << "name=\"Execution Time\"><Value>" << result->ExecutionTime << "</Value></NamedMeasurement>\n"; - if(result->Reason.size()) + if(!result->Reason.empty()) { const char* reasonType = "Pass Reason"; if(result->Status != cmCTestTestHandler::COMPLETED && @@ -1376,7 +1376,7 @@ void cmCTestTestHandler { std::string tempPath; - if (filepath.size() && + if (!filepath.empty() && filepath[filepath.size()-1] != '/') { filepath += "/"; @@ -1385,7 +1385,7 @@ void cmCTestTestHandler attempted.push_back(tempPath); attemptedConfigs.push_back(""); - if(ctest->GetConfigType().size()) + if(!ctest->GetConfigType().empty()) { tempPath = filepath; tempPath += ctest->GetConfigType(); @@ -1463,7 +1463,7 @@ std::string cmCTestTestHandler // even if a fullpath was specified also try it relative to the current // directory - if (filepath.size() && filepath[0] == '/') + if (!filepath.empty() && filepath[0] == '/') { std::string localfilepath = filepath.substr(1,filepath.size()-1); cmCTestTestHandler::AddConfigurations(ctest, attempted, diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 772c9aa..4c37c8b 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -94,7 +94,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale() { // restore the value of LC_MESSAGES after running the version control // commands - if(saveLCMessages.size()) + if(!saveLCMessages.empty()) { std::string put = "LC_MESSAGES="; put += saveLCMessages; diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index d77244a..f3f8008 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -80,7 +80,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file) // no need to search the file if we just did it if(function == lastfunction && lastroutine == routine) { - if(lastpath.size()) + if(!lastpath.empty()) { this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber] += count; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index ca1ed8b..e1bd02b 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -56,7 +56,7 @@ bool cmProcess::StartProcess() this->ProcessArgs.push_back(0); // null terminate the list this->Process = cmsysProcess_New(); cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin()); - if(this->WorkingDirectory.size()) + if(!this->WorkingDirectory.empty()) { cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); |