diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-08-18 18:04:21 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-08-18 18:04:21 (GMT) |
commit | 50ad1e0a144ae1f2267a4966789e5a16372f458e (patch) | |
tree | ab43b965115505a6d7367566d280b2d9b179ff11 /Source | |
parent | 7f97a6c94b59be7e7eba7362ce3eecdcff79ab70 (diff) | |
download | CMake-50ad1e0a144ae1f2267a4966789e5a16372f458e.zip CMake-50ad1e0a144ae1f2267a4966789e5a16372f458e.tar.gz CMake-50ad1e0a144ae1f2267a4966789e5a16372f458e.tar.bz2 |
CTest: don't use else after return
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestCVS.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestLaunch.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 37 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestP4.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 22 | ||||
-rw-r--r-- | Source/CTest/cmCTestUploadCommand.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmParseBlanketJSCoverage.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmParseMumpsCoverage.cxx | 19 | ||||
-rw-r--r-- | Source/CTest/cmProcess.cxx | 6 |
14 files changed, 66 insertions, 81 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index f96ef6d..230e8c5 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -532,9 +532,8 @@ public: if (this->FTC->FileTimeCompare(l.c_str(), r.c_str(), &result) && result != 0) { return result < 0; - } else { - return l < r; } + return l < r; } private: diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 37bdf9a..fb96308 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -216,10 +216,9 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir) std::string flag = "-r"; flag += tagLine.substr(1); return flag; - } else { - // Use the default branch. - return "-b"; } + // Use the default branch. + return "-b"; } void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag, diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3f37f2a..dd6eb3a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -763,12 +763,11 @@ int cmCTestCoverageHandler::HandleMumpsCoverage( this->Quiet); cov.ReadCoverageFile(coverageFile.c_str()); return static_cast<int>(cont->TotalCoverage.size()); - } else { - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Cannot find GTM coverage file: " << coverageFile - << std::endl, - this->Quiet); } + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find GTM coverage file: " << coverageFile + << std::endl, + this->Quiet); cmParseCacheCoverage ccov(*cont, this->CTest); coverageFile = this->CTest->GetBinaryDir() + "/cache_coverage.cmcov"; if (cmSystemTools::FileExists(coverageFile.c_str())) { diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 3eed79e..fedcb1f 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -126,12 +126,11 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv) this->HandleRealArg(this->RealArgV[i]); } return true; - } else { - this->RealArgC = 0; - this->RealArgV = CM_NULLPTR; - std::cerr << "No launch/command separator ('--') found!\n"; - return false; } + this->RealArgC = 0; + this->RealArgV = CM_NULLPTR; + std::cerr << "No launch/command separator ('--') found!\n"; + return false; } void cmCTestLaunch::HandleRealArg(const char* arg) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a06c351..7d0715f 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -638,27 +638,24 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, std::string& log, std::vector<int>& results) { - if (this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND) { - return this->ProcessMemCheckValgrindOutput(str, log, results); - } else if (this->MemoryTesterStyle == cmCTestMemCheckHandler::PURIFY) { - return this->ProcessMemCheckPurifyOutput(str, log, results); - } else if (this->MemoryTesterStyle == - cmCTestMemCheckHandler::ADDRESS_SANITIZER || - this->MemoryTesterStyle == - cmCTestMemCheckHandler::THREAD_SANITIZER || - this->MemoryTesterStyle == - cmCTestMemCheckHandler::MEMORY_SANITIZER || - this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER) { - return this->ProcessMemCheckSanitizerOutput(str, log, results); - } else if (this->MemoryTesterStyle == - cmCTestMemCheckHandler::BOUNDS_CHECKER) { - return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); - } else { - log.append("\nMemory checking style used was: "); - log.append("None that I know"); - log = str; + switch (this->MemoryTesterStyle) { + case cmCTestMemCheckHandler::VALGRIND: + return this->ProcessMemCheckValgrindOutput(str, log, results); + case cmCTestMemCheckHandler::PURIFY: + return this->ProcessMemCheckPurifyOutput(str, log, results); + case cmCTestMemCheckHandler::ADDRESS_SANITIZER: + case cmCTestMemCheckHandler::THREAD_SANITIZER: + case cmCTestMemCheckHandler::MEMORY_SANITIZER: + case cmCTestMemCheckHandler::UB_SANITIZER: + return this->ProcessMemCheckSanitizerOutput(str, log, results); + case cmCTestMemCheckHandler::BOUNDS_CHECKER: + return this->ProcessMemCheckBoundsCheckerOutput(str, log, results); + default: + log.append("\nMemory checking style used was: "); + log.append("None that I know"); + log = str; + return true; } - return true; } std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning( diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index a4e0b95..2632870 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -824,9 +824,8 @@ bool cmCTestMultiProcessHandler::CheckCycles() << this->Properties[root]->Name << "\".\nPlease fix the cycle and run ctest again.\n"); return false; - } else { - s.push(*d); } + s.push(*d); } } } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index d4a32f1..82422a3 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -373,9 +373,8 @@ std::string cmCTestP4::GetWorkingRevision() if (rev.empty()) { return "0"; - } else { - return rev; } + return rev; } void cmCTestP4::NoteOldRevision() diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9e3802a..49acbbf 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -54,7 +54,8 @@ bool cmCTestRunTest::CheckOutput() if (p == cmsysProcess_Pipe_None) { // Process has terminated and all output read. return false; - } else if (p == cmsysProcess_Pipe_STDOUT) { + } + if (p == cmsysProcess_Pipe_STDOUT) { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex() << ": " << line << std::endl); @@ -82,8 +83,7 @@ bool cmCTestRunTest::CheckOutput() } } } - } else // if(p == cmsysProcess_Pipe_Timeout) - { + } else { // if(p == cmsysProcess_Pipe_Timeout) break; } } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 06f838c..bee8296 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -80,11 +80,11 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2) // Does path p1 start with path p2? if (p1.size() == p2.size()) { return p1 == p2; - } else if (p1.size() > p2.size() && p1[p2.size()] == '/') { + } + if (p1.size() > p2.size() && p1[p2.size()] == '/') { return strncmp(p1.c_str(), p2.c_str(), p2.size()) == 0; - } else { - return false; } + return false; } std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) @@ -295,9 +295,8 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters, if (strcmp(parameters[0], "update") == 0) { return RunUpdateCommand(&args[0], out, err); - } else { - return RunChild(&args[0], out, err); } + return RunChild(&args[0], out, err); } class cmCTestSVN::LogParser : public cmCTestVC::OutputLogger, diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b932277..3ce0317 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -284,14 +284,13 @@ inline int GetNextNumber(std::string const& in, int& val, } pos = pos2 + 1; return 1; + } + if (in.size() - pos == 0) { + val = -1; } else { - if (in.size() - pos == 0) { - val = -1; - } else { - val = atoi(in.substr(pos, in.size() - pos).c_str()); - } - return 0; + val = atoi(in.substr(pos, in.size() - pos).c_str()); } + return 0; } // get the next number in a string with numbers separated by , @@ -311,14 +310,13 @@ inline int GetNextRealNumber(std::string const& in, double& val, } pos = pos2 + 1; return 1; + } + if (in.size() - pos == 0) { + val = -1; } else { - if (in.size() - pos == 0) { - val = -1; - } else { - val = atof(in.substr(pos, in.size() - pos).c_str()); - } - return 0; + val = atof(in.substr(pos, in.size() - pos).c_str()); } + return 0; } cmCTestTestHandler::cmCTestTestHandler() diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 7393d21..016b32b 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -49,14 +49,13 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) if (cmSystemTools::FileExists(arg.c_str())) { this->Files.insert(arg); return true; - } else { - std::ostringstream e; - e << "File \"" << arg << "\" does not exist. Cannot submit " - << "a non-existent file."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - this->ArgumentDoing = ArgumentDoingError; - return false; } + std::ostringstream e; + e << "File \"" << arg << "\" does not exist. Cannot submit " + << "a non-existent file."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + this->ArgumentDoing = ArgumentDoingError; + return false; } // Look for other arguments. diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx index fa539e4..976a92d 100644 --- a/Source/CTest/cmParseBlanketJSCoverage.cxx +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -42,9 +42,8 @@ public: std::string foundFileName = line.substr(begIndex + 3, endIndex - (begIndex + 4)); return foundFileName; - } else { - return line.substr(begIndex, line.npos); } + return line.substr(begIndex, line.npos); } bool ParseFile(std::string const& file) { diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index d786d79..af01496 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -128,16 +128,15 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, if (i != this->RoutineToDirectory.end()) { filepath = i->second; return true; - } else { - // try some alternate names - const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR }; - for (int k = 0; tryname[k] != CM_NULLPTR; k++) { - std::string routine2 = routine + tryname[k]; - i = this->RoutineToDirectory.find(routine2); - if (i != this->RoutineToDirectory.end()) { - filepath = i->second; - return true; - } + } + // try some alternate names + const char* tryname[] = { "GUX", "GTM", "ONT", CM_NULLPTR }; + for (int k = 0; tryname[k] != CM_NULLPTR; k++) { + std::string routine2 = routine + tryname[k]; + i = this->RoutineToDirectory.find(routine2); + if (i != this->RoutineToDirectory.end()) { + filepath = i->second; + return true; } } return false; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 92fe642..30cd102 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -124,10 +124,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout) int p = cmsysProcess_WaitForData(this->Process, &data, &length, &timeout); if (p == cmsysProcess_Pipe_Timeout) { return cmsysProcess_Pipe_Timeout; - } else if (p == cmsysProcess_Pipe_STDOUT) { + } + if (p == cmsysProcess_Pipe_STDOUT) { this->Output.insert(this->Output.end(), data, data + length); - } else // p == cmsysProcess_Pipe_None - { + } else { // p == cmsysProcess_Pipe_None // The process will provide no more data. break; } |