From 77f674be35717a6eb296246733885b5a7ddf95ec Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Wed, 20 Sep 2017 23:53:14 +0200 Subject: Fix some occurrences of readability-braces-around-statements Fix issues diagnosed by clang-tidy [readability-braces-around-statements] Signed-off-by: Matthias Maennich --- Source/CPack/cmCPackDragNDropGenerator.cxx | 3 ++- Source/CPack/cmCPackPackageMakerGenerator.cxx | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 36 ++++++++++++++++----------- Source/cmXCodeObject.cxx | 3 ++- Source/cmXCodeScheme.cxx | 3 ++- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 72ddd6a..45c7fc6 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -866,10 +866,11 @@ bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, size_t line_length = max_line_length; if (i + line_length > line.size()) { line_length = line.size() - i; - } else + } else { while (line_length > 0 && line[i + line_length - 1] != ' ') { line_length = line_length - 1; } + } if (line_length == 0) { *error = "Please make sure there are no words " diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 6624b16..0299279 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -275,8 +275,9 @@ int cmCPackPackageMakerGenerator::PackageFiles() if (this->PackageMakerVersion > 2.0) { pkgCmd << " -v"; } - if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) + if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) { return 0; + } } else { // We have built the package in place. Generate the // distribution.dist file to describe it for the installer. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c218641..304a188 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -163,8 +163,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( const std::string& name, cmake* cm) const { - if (name != GetActualName()) + if (name != GetActualName()) { return nullptr; + } #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; std::string versionFile; @@ -2344,10 +2345,12 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" : "archive.ar"); case cmStateEnums::MODULE_LIBRARY: - if (target->IsXCTestOnApple()) + if (target->IsXCTestOnApple()) { return "wrapper.cfbundle"; - if (target->IsCFBundleOnApple()) + } + if (target->IsCFBundleOnApple()) { return "wrapper.plug-in"; + } return "compiled.mach-o.executable"; case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") @@ -2376,12 +2379,13 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( ? "com.apple.product-type.framework" : "com.apple.product-type.library.static"); case cmStateEnums::MODULE_LIBRARY: - if (target->IsXCTestOnApple()) + if (target->IsXCTestOnApple()) { return "com.apple.product-type.bundle.unit-test"; - else if (target->IsCFBundleOnApple()) + } else if (target->IsCFBundleOnApple()) { return "com.apple.product-type.bundle"; - else + } else { return "com.apple.product-type.tool"; + } case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "com.apple.product-type.framework" @@ -2710,16 +2714,18 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent, const std::string& name) { cmXCodeObject* parentChildren = nullptr; - if (parent) + if (parent) { parentChildren = parent->GetObject("children"); + } cmXCodeObject* group = this->CreateObject(cmXCodeObject::PBXGroup); cmXCodeObject* groupChildren = this->CreateObject(cmXCodeObject::OBJECT_LIST); group->AddAttribute("name", this->CreateString(name)); group->AddAttribute("children", groupChildren); group->AddAttribute("sourceTree", this->CreateString("")); - if (parentChildren) + if (parentChildren) { parentChildren->AddObject(group); + } return group; } @@ -2866,15 +2872,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( v << std::setfill('0') << std::setw(4) << XcodeVersion * 10; group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str())); this->RootObject->AddAttribute("attributes", group); - if (this->XcodeVersion >= 32) + if (this->XcodeVersion >= 32) { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.2")); - else if (this->XcodeVersion >= 31) + } else if (this->XcodeVersion >= 31) { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.1")); - else + } else { this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.0")); + } // Point Xcode at the top of the source tree. { std::string pdir = @@ -3333,12 +3340,13 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::Indent(1, fout); fout << "};\n"; cmXCodeObject::Indent(1, fout); - if (this->XcodeVersion >= 32) + if (this->XcodeVersion >= 32) { fout << "objectVersion = 46;\n"; - else if (this->XcodeVersion >= 31) + } else if (this->XcodeVersion >= 31) { fout << "objectVersion = 45;\n"; - else + } else { fout << "objectVersion = 44;\n"; + } cmXCode21Object::PrintList(this->XCodeObjects, fout); cmXCodeObject::Indent(1, fout); fout << "rootObject = " << this->RootObject->GetId() diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index e0ed445..e54f1f3 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -120,8 +120,9 @@ void cmXCodeObject::Print(std::ostream& out) out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; for (i = this->ObjectAttributes.begin(); i != this->ObjectAttributes.end(); ++i) { - if (i->first == "isa") + if (i->first == "isa") { continue; + } PrintAttribute(out, 3, separator, indentFactor, i->first, i->second, this); } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 29de35e..f1dce64 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -222,8 +222,9 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name) // if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) == this->ConfigList.end() && - !this->ConfigList.empty()) + !this->ConfigList.empty()) { return this->ConfigList[0]; + } return name; } -- cgit v0.12