mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 11:22:21 -06:00
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>
This commit is contained in:
committed by
Brad King
parent
2033abff0d
commit
870dd06da1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
return (t1 - t2) >= bil;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (t2 < t1) {
|
||||
return (t1 - t2) >= bil;
|
||||
}
|
||||
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) {
|
||||
return (s1->st_mtime - s2->st_mtime) >= 1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (s1->st_mtime > s2->st_mtime) {
|
||||
return (s1->st_mtime - s2->st_mtime) >= 1;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
#else
|
||||
// Times are integers in units of 100ns.
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user