Browse Source

Fix left-over occurrences of else-after-return

Fix issues diagnosed by clang-tidy [readability-else-after-return]

These were mostly only showing up on OSX.

Signed-off-by: Matthias Maennich <matthias@maennich.net>
pull/315/head
Matthias Maennich 8 years ago
committed by Brad King
parent
commit
870dd06da1
  1. 12
      Source/CPack/cmCPackDragNDropGenerator.cxx
  2. 4
      Source/CPack/cmCPackPKGGenerator.cxx
  3. 5
      Source/cmFileCommand.cxx
  4. 24
      Source/cmFileTimeComparison.cxx
  5. 16
      Source/cmGlobalXCodeGenerator.cxx

12
Source/CPack/cmCPackDragNDropGenerator.cxx

@ -226,14 +226,14 @@ bool cmCPackDragNDropGenerator::CreateEmptyFile(std::ostringstream& target,
cmsys::ofstream fout(target.str().c_str(), std::ios::out | std::ios::binary);
if (!fout) {
return false;
} else {
// Seek to desired size - 1 byte
fout.seekp(size - 1, std::ios::beg);
char byte = 0;
// Write one byte to ensure file grows
fout.write(&byte, 1);
}
// Seek to desired size - 1 byte
fout.seekp(size - 1, std::ios::beg);
char byte = 0;
// Write one byte to ensure file grows
fout.write(&byte, 1);
return true;
}

4
Source/CPack/cmCPackPKGGenerator.cxx

@ -42,9 +42,9 @@ std::string cmCPackPKGGenerator::GetPackageName(
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-"
<< component.Name << ".pkg";
return out.str();
} else {
return component.ArchiveFile + ".pkg";
}
return component.ArchiveFile + ".pkg";
}
void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile)

5
Source/cmFileCommand.cxx

@ -2294,10 +2294,9 @@ bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
if (errorArg.GetString().empty()) {
this->SetError(error);
return false;
} else {
this->Makefile->AddDefinition(errorArg.GetString(), error.c_str());
return true;
}
this->Makefile->AddDefinition(errorArg.GetString(), error.c_str());
return true;
#endif
}

24
Source/cmFileTimeComparison.cxx

@ -116,18 +116,22 @@ int cmFileTimeComparisonInternal::Compare(cmFileTimeComparison_Type* s1,
// Compare using nanosecond resolution.
if (s1->st_mtimespec.tv_sec < s2->st_mtimespec.tv_sec) {
return -1;
} else if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) {
}
if (s1->st_mtimespec.tv_sec > s2->st_mtimespec.tv_sec) {
return 1;
} else if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) {
}
if (s1->st_mtimespec.tv_nsec < s2->st_mtimespec.tv_nsec) {
return -1;
} else if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) {
}
if (s1->st_mtimespec.tv_nsec > s2->st_mtimespec.tv_nsec) {
return 1;
}
#else
// Compare using 1 second resolution.
if (s1->st_mtime < s2->st_mtime) {
return -1;
} else if (s1->st_mtime > s2->st_mtime) {
}
if (s1->st_mtime > s2->st_mtime) {
return 1;
}
#endif
@ -162,20 +166,20 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1,
long long t2 = s2->st_mtimespec.tv_sec * bil + s2->st_mtimespec.tv_nsec;
if (t1 < t2) {
return (t2 - t1) >= bil;
} else if (t2 < t1) {
}
if (t2 < t1) {
return (t1 - t2) >= bil;
} else {
return false;
}
return false;
#else
// Times are integers in units of 1s.
if (s1->st_mtime < s2->st_mtime) {
return (s2->st_mtime - s1->st_mtime) >= 1;
} else if (s1->st_mtime > s2->st_mtime) {
}
if (s1->st_mtime > s2->st_mtime) {
return (s1->st_mtime - s2->st_mtime) >= 1;
} else {
return false;
}
return false;
#endif
#else
// Times are integers in units of 100ns.

16
Source/cmGlobalXCodeGenerator.cxx

@ -111,9 +111,8 @@ public:
{
if (this->Group) {
return this->Group;
} else {
return this->Generator->CreateString(this->String);
}
return this->Generator->CreateString(this->String);
}
};
@ -240,10 +239,9 @@ std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
makeProgram = "xcodebuild";
}
return makeProgram;
} else {
// Use cmakexbuild wrapper to suppress environment dump from output.
return cmSystemTools::GetCMakeCommand() + "xbuild";
}
// Use cmakexbuild wrapper to suppress environment dump from output.
return cmSystemTools::GetCMakeCommand() + "xbuild";
}
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
@ -2355,9 +2353,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
(target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
return "OTHER_LIBTOOLFLAGS";
} else {
return "OTHER_LDFLAGS";
}
return "OTHER_LDFLAGS";
}
const char* cmGlobalXCodeGenerator::GetTargetFileType(
@ -2376,10 +2373,9 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(
case cmStateEnums::MODULE_LIBRARY:
if (target->IsXCTestOnApple())
return "wrapper.cfbundle";
else if (target->IsCFBundleOnApple())
if (target->IsCFBundleOnApple())
return "wrapper.plug-in";
else
return "compiled.mach-o.executable";
return "compiled.mach-o.executable";
case cmStateEnums::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework"

Loading…
Cancel
Save