Browse Source

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>
pull/315/head
Matthias Maennich 8 years ago
committed by Brad King
parent
commit
77f674be35
  1. 3
      Source/CPack/cmCPackDragNDropGenerator.cxx
  2. 3
      Source/CPack/cmCPackPackageMakerGenerator.cxx
  3. 36
      Source/cmGlobalXCodeGenerator.cxx
  4. 3
      Source/cmXCodeObject.cxx
  5. 3
      Source/cmXCodeScheme.cxx

3
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 "

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

36
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()

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

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

Loading…
Cancel
Save