CTest: don't use else after return

This commit is contained in:
Daniel Pfeifer 2016-08-18 20:04:21 +02:00
parent 7f97a6c94b
commit 50ad1e0a14
14 changed files with 69 additions and 84 deletions

View File

@ -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:

View File

@ -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,

View File

@ -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())) {

View File

@ -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)

View File

@ -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(

View File

@ -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);
}
}
}

View File

@ -373,9 +373,8 @@ std::string cmCTestP4::GetWorkingRevision()
if (rev.empty()) {
return "0";
} else {
return rev;
}
return rev;
}
void cmCTestP4::NoteOldRevision()

View File

@ -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;
}
}

View File

@ -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()] == '/') {
return strncmp(p1.c_str(), p2.c_str(), p2.size()) == 0;
} else {
return false;
}
if (p1.size() > p2.size() && p1[p2.size()] == '/') {
return strncmp(p1.c_str(), p2.c_str(), p2.size()) == 0;
}
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,

View File

@ -284,14 +284,13 @@ inline int GetNextNumber(std::string const& in, int& val,
}
pos = pos2 + 1;
return 1;
} else {
if (in.size() - pos == 0) {
val = -1;
} else {
val = atoi(in.substr(pos, in.size() - pos).c_str());
}
return 0;
}
if (in.size() - pos == 0) {
val = -1;
} else {
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;
} else {
if (in.size() - pos == 0) {
val = -1;
} else {
val = atof(in.substr(pos, in.size() - pos).c_str());
}
return 0;
}
if (in.size() - pos == 0) {
val = -1;
} else {
val = atof(in.substr(pos, in.size() - pos).c_str());
}
return 0;
}
cmCTestTestHandler::cmCTestTestHandler()

View File

@ -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.

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
}