summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2017-09-20 21:53:14 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-28 11:23:43 (GMT)
commit77f674be35717a6eb296246733885b5a7ddf95ec (patch)
tree308de087b0babb7799c8c99c4352faa158969012
parentf0bab294dcd3f2c4f3be5e491426b5eefb2a9aba (diff)
downloadCMake-77f674be35717a6eb296246733885b5a7ddf95ec.zip
CMake-77f674be35717a6eb296246733885b5a7ddf95ec.tar.gz
CMake-77f674be35717a6eb296246733885b5a7ddf95ec.tar.bz2
Fix some occurrences of readability-braces-around-statements
Fix issues diagnosed by clang-tidy [readability-braces-around-statements] Signed-off-by: Matthias Maennich <matthias@maennich.net>
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx36
-rw-r--r--Source/cmXCodeObject.cxx3
-rw-r--r--Source/cmXCodeScheme.cxx3
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("<group>"));
- 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;
}