summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-10 16:36:24 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-10 16:36:24 (GMT)
commita16bf141bc5d393b27d13d8235d95a1b034052c2 (patch)
tree59ecd625114f6e98065e7901f418a28fc540cd45 /Source
parentbd9e551c1a13f566e6ffe8cdd1262b7628ed5330 (diff)
downloadCMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.zip
CMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.tar.gz
CMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.tar.bz2
Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements checker.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx24
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx3
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx15
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx13
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx25
-rw-r--r--Source/CTest/cmCTestBZR.cxx9
-rw-r--r--Source/CTest/cmCTestHG.cxx3
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx12
-rw-r--r--Source/CTest/cmCTestP4.cxx3
-rw-r--r--Source/CTest/cmCTestSVN.cxx3
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx4
-rw-r--r--Source/cmCacheManager.cxx3
-rw-r--r--Source/cmDependsC.cxx3
-rw-r--r--Source/cmGeneratorTarget.cxx21
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx27
-rw-r--r--Source/cmLocalNinjaGenerator.cxx21
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx15
-rw-r--r--Source/cmNinjaTargetGenerator.cxx24
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx11
-rw-r--r--Source/cmOSXBundleGenerator.cxx18
-rw-r--r--Source/cmSystemTools.cxx10
-rw-r--r--Source/cmTarget.cxx3
24 files changed, 181 insertions, 95 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index c1ff526..b47d46e 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -345,18 +345,21 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end())
+ if (cit != Components.end()) {
return &(cit->second);
+ }
cmCPackComponent* component =
cmCPackGenerator::GetComponent(projectName, componentName);
- if (!component)
+ if (!component) {
return component;
+ }
std::string name = GetComponentPackageName(component);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return component;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -387,13 +390,15 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
{
cmCPackComponentGroup* group =
cmCPackGenerator::GetComponentGroup(projectName, groupName);
- if (!group)
+ if (!group) {
return group;
+ }
std::string name = GetGroupPackageName(group);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return group;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -462,8 +467,9 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
cmCPackComponentGroup* group) const
{
std::string name;
- if (!group)
+ if (!group) {
return name;
+ }
if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
return package->Name;
}
@@ -488,8 +494,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
cmCPackComponent* component) const
{
std::string name;
- if (!component)
+ if (!component) {
return name;
+ }
if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
return package->Name;
}
@@ -534,8 +541,9 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end())
+ if (rit != Repositories.end()) {
return &(rit->second);
+ }
cmCPackIFWRepository* repository = &Repositories[repositoryName];
repository->Name = repositoryName;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index dfc509b..74f6da6 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index ad153d1..c44e389 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -71,8 +71,9 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
{
- if (Compare.Type == CompareNone)
+ if (Compare.Type == CompareNone) {
return Name;
+ }
std::string result = Name;
@@ -128,8 +129,9 @@ bool cmCPackIFWPackage::IsVersionEqual(const char* version)
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return "";
+ }
const char* option =
GetOption("CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
@@ -189,8 +191,9 @@ int cmCPackIFWPackage::ConfigureFromOptions()
int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -284,8 +287,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
{
- if (!group)
+ if (!group) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -474,6 +478,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 1838005..b8a10c6 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -89,8 +89,9 @@ bool cmCPackIFWRepository::IsVersionEqual(const char* version)
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
- if (Name.empty())
+ if (Name.empty()) {
return false;
+ }
std::string prefix =
"CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
@@ -198,8 +199,9 @@ protected:
patched = true;
}
xout.EndElement();
- if (patched)
+ if (patched) {
return;
+ }
if (name == "Checksum") {
repository->WriteRepositoryUpdates(xout);
patched = true;
@@ -209,8 +211,10 @@ protected:
virtual void CharacterDataHandler(const char* data, int length)
{
std::string content(data, data + length);
- if (content == "" || content == " " || content == " " || content == "\n")
+ if (content == "" || content == " " || content == " " ||
+ content == "\n") {
return;
+ }
xout.Content(content);
}
};
@@ -332,6 +336,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index bef0fb4..b659359 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -826,8 +826,9 @@ static int copy_ar(CF* cfp, off_t size)
size_t nr, nw;
char buf[8 * 1024];
- if (sz == 0)
+ if (sz == 0) {
return 0;
+ }
FILE* from = cfp->rFile;
FILE* to = cfp->wFile;
@@ -837,16 +838,20 @@ static int copy_ar(CF* cfp, off_t size)
: sizeof(buf),
from)) > 0) {
sz -= nr;
- for (size_t off = 0; off < nr; nr -= off, off += nw)
- if ((nw = fwrite(buf + off, 1, nr, to)) < nr)
+ for (size_t off = 0; off < nr; nr -= off, off += nw) {
+ if ((nw = fwrite(buf + off, 1, nr, to)) < nr) {
return -1;
+ }
+ }
}
- if (sz)
+ if (sz) {
return -2;
+ }
if (cfp->flags & WPAD && (size + ar_already_written) & 1 &&
- fwrite(&pad, 1, 1, to) != 1)
+ fwrite(&pad, 1, 1, to) != 1) {
return -4;
+ }
return 0;
}
@@ -874,11 +879,11 @@ static int put_arobj(CF* cfp, struct stat* sb)
if (gid > USHRT_MAX) {
gid = USHRT_MAX;
}
- if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
+ if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) {
(void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime,
(unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode,
(long long)sb->st_size + lname, ARFMAG);
- else {
+ } else {
lname = 0;
(void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid,
(unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size,
@@ -886,12 +891,14 @@ static int put_arobj(CF* cfp, struct stat* sb)
}
off_t size = sb->st_size;
- if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR))
+ if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) {
return -1;
+ }
if (lname) {
- if (fwrite(name, 1, lname, cfp->wFile) != lname)
+ if (fwrite(name, 1, lname, cfp->wFile) != lname) {
return -2;
+ }
ar_already_written = lname;
}
result = copy_ar(cfp, size);
diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx
index dd53be8..92eb570 100644
--- a/Source/CTest/cmCTestBZR.cxx
+++ b/Source/CTest/cmCTestBZR.cxx
@@ -61,8 +61,9 @@ extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*,
// workaround for these unknown encodings.
if (name == std::string("ascii") || name == std::string("cp1252") ||
name == std::string("ANSI_X3.4-1968")) {
- for (unsigned int i = 0; i < 256; ++i)
+ for (unsigned int i = 0; i < 256; ++i) {
info->map[i] = latin1[i];
+ }
return 1;
}
@@ -336,8 +337,9 @@ private:
void DoPath(char c0, char c1, char c2, std::string path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
cmSystemTools::ConvertToUnixSlashes(path);
const std::string dir = cmSystemTools::GetFilenamePath(path);
@@ -441,8 +443,9 @@ private:
void DoPath(char c0, char c1, char c2, std::string path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
cmSystemTools::ConvertToUnixSlashes(path);
if (c0 == 'C') {
diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx
index c6cfa44..f1fe377 100644
--- a/Source/CTest/cmCTestHG.cxx
+++ b/Source/CTest/cmCTestHG.cxx
@@ -75,8 +75,9 @@ private:
void DoPath(char status, std::string const& path)
{
- if (path.empty())
+ if (path.empty()) {
return;
+ }
// See "hg help status". Note that there is no 'conflict' status.
switch (status) {
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 7b384ad..ae97d32 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -413,12 +413,14 @@ void cmCTestMultiProcessHandler::UpdateCostData()
std::string line;
while (std::getline(fin, line)) {
- if (line == "---")
+ if (line == "---") {
break;
+ }
std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
// Format: <name> <previous_runs> <avg_cost>
- if (parts.size() < 3)
+ if (parts.size() < 3) {
break;
+ }
std::string name = parts[0];
int prev = atoi(parts[1].c_str());
@@ -464,8 +466,9 @@ void cmCTestMultiProcessHandler::ReadCostData()
fin.open(fname.c_str());
std::string line;
while (std::getline(fin, line)) {
- if (line == "---")
+ if (line == "---") {
break;
+ }
std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' ');
@@ -480,8 +483,9 @@ void cmCTestMultiProcessHandler::ReadCostData()
float cost = static_cast<float>(atof(parts[2].c_str()));
int index = this->SearchByName(name);
- if (index == -1)
+ if (index == -1) {
continue;
+ }
this->Properties[index]->PreviousRuns = prev;
// When not running in parallel mode, don't use cost data
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 07f9dad..ede11c9 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -426,8 +426,9 @@ void cmCTestP4::LoadRevisions()
ChangeLists.clear();
this->RunChild(&p4_changes[0], &out, &err);
- if (ChangeLists.empty())
+ if (ChangeLists.empty()) {
return;
+ }
// p4 describe -s ...@1111111,2222222
std::vector<char const*> p4_describe;
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index a6885aa..fa01411 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -271,8 +271,9 @@ bool cmCTestSVN::UpdateImpl()
bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
OutputParser* out, OutputParser* err)
{
- if (parameters.empty())
+ if (parameters.empty()) {
return false;
+ }
std::vector<char const*> args;
args.push_back(this->CommandLineTool.c_str());
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 84672ae..d03d330 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -54,9 +54,9 @@ void cmCursesLongMessageForm::UpdateStatusBar()
size = cmCursesMainForm::MAX_WIDTH - 1;
}
strncpy(bar, this->Title.c_str(), size);
- for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++)
+ for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) {
bar[i] = ' ';
-
+ }
int width;
if (x < cmCursesMainForm::MAX_WIDTH) {
width = x;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 676e84a..9adfdaf 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -71,8 +71,9 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
while (*realbuffer != '0' &&
(*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\r' ||
*realbuffer == '\n')) {
- if (*realbuffer == '\n')
+ if (*realbuffer == '\n') {
lineno++;
+ }
realbuffer++;
}
// skip blank lines and comment lines
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index f81bf06..57e719c 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -158,7 +158,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->HeaderLocationCache.find(current.FileName);
if (headerLocationIt != this->HeaderLocationCache.end()) {
fullName = headerLocationIt->second;
- } else
+ } else {
for (std::vector<std::string>::const_iterator i =
this->IncludePath.begin();
i != this->IncludePath.end(); ++i) {
@@ -175,6 +175,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
break;
}
}
+ }
}
// Complain if the file cannot be found and matches the complain
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 1607dd9..de02395 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1348,8 +1348,9 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
fpath += ".app";
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -1377,8 +1378,9 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
fpath += ext;
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -3336,11 +3338,13 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3);
}
@@ -3351,14 +3355,17 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s4);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3, s4);
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3abcba3..f74e835 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -30,8 +30,9 @@ const char* cmGlobalNinjaGenerator::INDENT = " ";
void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
{
- for (int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i) {
os << cmGlobalNinjaGenerator::INDENT;
+ }
}
void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
@@ -43,8 +44,9 @@ void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
const std::string& comment)
{
- if (comment.empty())
+ if (comment.empty()) {
return;
+ }
std::string::size_type lpos = 0;
std::string::size_type rpos;
@@ -165,16 +167,18 @@ void cmGlobalNinjaGenerator::WriteBuild(
if (!implicitDeps.empty()) {
arguments += " |";
for (cmNinjaDeps::const_iterator i = implicitDeps.begin();
- i != implicitDeps.end(); ++i)
+ i != implicitDeps.end(); ++i) {
arguments += " " + EncodeIdent(EncodePath(*i), os);
+ }
}
// Write order-only dependencies.
if (!orderOnlyDeps.empty()) {
arguments += " ||";
for (cmNinjaDeps::const_iterator i = orderOnlyDeps.begin();
- i != orderOnlyDeps.end(); ++i)
+ i != orderOnlyDeps.end(); ++i) {
arguments += " " + EncodeIdent(EncodePath(*i), os);
+ }
}
arguments += "\n";
@@ -198,9 +202,10 @@ void cmGlobalNinjaGenerator::WriteBuild(
// Write the variables bound to this build statement.
std::ostringstream variable_assignments;
for (cmNinjaVars::const_iterator i = variables.begin(); i != variables.end();
- ++i)
+ ++i) {
cmGlobalNinjaGenerator::WriteVariable(variable_assignments, i->first,
i->second, "", 1);
+ }
// check if a response file rule should be used
std::string buildstr = build;
@@ -430,8 +435,9 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
cmGlobalNinjaGenerator::WriteComment(os, comment);
os << "default";
for (cmNinjaDeps::const_iterator i = targets.begin(); i != targets.end();
- ++i)
+ ++i) {
os << " " << *i;
+ }
os << "\n";
}
@@ -907,15 +913,17 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
this->AppendTargetOutputs(target, outputs);
// Mark the target's outputs as ambiguous to ensure that no other target uses
// the output as an alias.
- for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i)
+ for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) {
TargetAliases[*i] = 0;
+ }
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
TargetAliases.insert(std::make_pair(buildAlias, target));
- if (newAlias.second && newAlias.first->second != target)
+ if (newAlias.second && newAlias.first->second != target) {
newAlias.first->second = 0;
+ }
}
void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
@@ -926,8 +934,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
for (TargetAliasMap::const_iterator i = TargetAliases.begin();
i != TargetAliases.end(); ++i) {
// Don't write ambiguous aliases.
- if (!i->second)
+ if (!i->second) {
continue;
+ }
cmNinjaDeps deps;
this->AppendTargetOutputs(i->second, deps);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 6c231c3..6e676f1 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -81,8 +81,9 @@ void cmLocalNinjaGenerator::Generate()
tg->Generate();
// Add the target to "all" if required.
if (!this->GetGlobalNinjaGenerator()->IsExcluded(
- this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t))
+ this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) {
this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t);
+ }
delete tg;
}
}
@@ -257,8 +258,9 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
os << "# Write statements declared in CMakeLists.txt:" << std::endl
<< "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE")
<< std::endl;
- if (this->IsRootMakefile())
+ if (this->IsRootMakefile()) {
os << "# Which is the root file." << std::endl;
+ }
cmGlobalNinjaGenerator::WriteDivider(os);
os << std::endl;
}
@@ -282,9 +284,10 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(
for (std::vector<std::string>::const_iterator i = deps.begin();
i != deps.end(); ++i) {
std::string dep;
- if (this->GetRealDependency(*i, this->GetConfigName(), dep))
+ if (this->GetRealDependency(*i, this->GetConfigName(), dep)) {
ninjaDeps.push_back(
this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(dep));
+ }
}
}
@@ -294,12 +297,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
// If we have no commands but we need to build a command anyway, use ":".
// This happens when building a POST_BUILD value for link targets that
// don't use POST_BUILD.
- if (cmdLines.empty())
+ if (cmdLines.empty()) {
#ifdef _WIN32
return "cd .";
#else
return ":";
#endif
+ }
std::ostringstream cmd;
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
@@ -332,8 +336,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
{
if (ccg.GetNumberOfCommands() > 0) {
std::string wd = ccg.GetWorkingDirectory();
- if (wd.empty())
+ if (wd.empty()) {
wd = this->GetCurrentBinaryDirectory();
+ }
std::ostringstream cdCmd;
#ifdef _WIN32
@@ -361,8 +366,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps)
{
- if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc))
+ if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) {
return;
+ }
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this);
@@ -391,8 +397,9 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
this->AppendCustomCommandDeps(ccg, ninjaDeps);
for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end();
- ++i)
+ ++i) {
this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i);
+ }
std::vector<std::string> cmdLines;
this->AppendCustomCommandLines(ccg, cmdLines);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ca30b3d..e3d6614 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3620,8 +3620,9 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
bool cmMakefile::IsAlias(const std::string& name) const
{
- if (this->AliasTargets.find(name) != this->AliasTargets.end())
+ if (this->AliasTargets.find(name) != this->AliasTargets.end()) {
return true;
+ }
return this->GetGlobalGenerator()->IsAlias(name);
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 0998eb8..438f90f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -329,8 +329,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
buildEcho += " shared library ";
break;
case cmState::MODULE_LIBRARY:
- if (this->GeneratorTarget->IsCFBundleOnApple())
+ if (this->GeneratorTarget->IsCFBundleOnApple()) {
buildEcho += " CFBundle";
+ }
buildEcho += " shared module ";
break;
default:
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index fdce542..5225e3f 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -41,15 +41,16 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
, TargetLinkLanguage("")
{
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
- if (target->GetType() == cmState::EXECUTABLE)
+ if (target->GetType() == cmState::EXECUTABLE) {
this->GetGeneratorTarget()->GetExecutableNames(
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
this->TargetNamePDB, GetLocalGenerator()->GetConfigName());
- else
+ } else {
this->GetGeneratorTarget()->GetLibraryNames(
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
this->TargetNameImport, this->TargetNamePDB,
GetLocalGenerator()->GetConfigName());
+ }
if (target->GetType() != cmState::OBJECT_LIBRARY) {
// on Windows the output dir is already needed at compile time
@@ -125,10 +126,11 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
case cmState::SHARED_LIBRARY:
return "shared library";
case cmState::MODULE_LIBRARY:
- if (this->GetGeneratorTarget()->IsCFBundleOnApple())
+ if (this->GetGeneratorTarget()->IsCFBundleOnApple()) {
return "CFBundle shared module";
- else
+ } else {
return "shared module";
+ }
case cmState::EXECUTABLE:
return "executable";
default:
@@ -271,7 +273,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
- if (targetType == cmState::EXECUTABLE)
+ if (targetType == cmState::EXECUTABLE) {
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_EXECUTABLE",
cmakeCommand + " -E cmake_symlink_executable"
@@ -284,7 +286,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
/*rspcontent*/ "",
/*restat*/ "",
/*generator*/ false);
- else
+ } else {
this->GetGlobalGenerator()->AddRule(
"CMAKE_SYMLINK_LIBRARY",
cmakeCommand + " -E cmake_symlink_library"
@@ -297,6 +299,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
/*rspcontent*/ "",
/*restat*/ "",
/*generator*/ false);
+ }
}
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b0f0d9b..05a0a63 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -46,8 +46,9 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
// (i.e. top-level) directory. CMake creates copies of these targets
// in every directory, which we don't need.
if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(),
- target->GetLocalGenerator()->GetSourceDirectory()) == 0)
+ target->GetLocalGenerator()->GetSourceDirectory()) == 0) {
return new cmNinjaUtilityTargetGenerator(target);
+ }
// else fallthrough
}
@@ -132,8 +133,9 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
includes, this->GeneratorTarget, language,
language == "RC", // full include paths for RC needed by cmcldeps
false, this->GetConfigName());
- if (this->GetGlobalGenerator()->IsGCCOnWindows())
+ if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
+ }
this->LocalGenerator->AppendFlags(languageFlags, includeFlags);
}
@@ -170,13 +172,15 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
{
// Static libraries never depend on other targets for linking.
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
- this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY)
+ this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) {
return cmNinjaDeps();
+ }
cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(this->GetConfigName());
- if (!cli)
+ if (!cli) {
return cmNinjaDeps();
+ }
const std::vector<std::string>& deps = cli->GetDepends();
cmNinjaDeps result(deps.size());
@@ -218,8 +222,9 @@ std::string cmNinjaTargetGenerator::GetObjectFilePath(
cmSourceFile const* source) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
- if (!path.empty())
+ if (!path.empty()) {
path += "/";
+ }
std::string const& objectName = this->GeneratorTarget->GetObjectName(source);
path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
path += "/";
@@ -237,8 +242,9 @@ std::string cmNinjaTargetGenerator::GetTargetFilePath(
const std::string& name) const
{
std::string path = this->GetTargetOutputDir();
- if (path.empty() || path == ".")
+ if (path.empty() || path == ".") {
return name;
+ }
path += "/";
path += name;
return path;
@@ -420,8 +426,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
for (std::vector<std::string>::iterator i = compileCmds.begin();
- i != compileCmds.end(); ++i)
+ i != compileCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
+ }
std::string cmdLine =
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
@@ -653,8 +660,9 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
for (std::vector<std::string>::iterator i = compileCmds.begin();
- i != compileCmds.end(); ++i)
+ i != compileCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars);
+ }
std::string cmdLine =
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index f7a7f38..c549646 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -57,8 +57,9 @@ void cmNinjaUtilityTargetGenerator::Generate()
std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
std::transform(ccByproducts.begin(), ccByproducts.end(),
std::back_inserter(util_outputs), MapToNinjaPath());
- if (ci->GetUsesTerminal())
+ if (ci->GetUsesTerminal()) {
uses_terminal = true;
+ }
}
}
@@ -99,10 +100,11 @@ void cmNinjaUtilityTargetGenerator::Generate()
const char* echoStr =
this->GetGeneratorTarget()->GetProperty("EchoString");
std::string desc;
- if (echoStr)
+ if (echoStr) {
desc = echoStr;
- else
+ } else {
desc = "Running utility command for " + this->GetTargetName();
+ }
// TODO: fix problematic global targets. For now, search and replace the
// makefile vars.
@@ -122,8 +124,9 @@ void cmNinjaUtilityTargetGenerator::Generate()
.c_str());
cmSystemTools::ReplaceString(command, "$(ARGS)", "");
- if (command.find('$') != std::string::npos)
+ if (command.find('$') != std::string::npos) {
return;
+ }
for (cmNinjaDeps::const_iterator oi = util_outputs.begin(),
oe = util_outputs.end();
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index f62ba40..c19cae0 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -25,8 +25,9 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target,
, ConfigName(configName)
, MacContentFolders(0)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
}
bool cmOSXBundleGenerator::MustSkip()
@@ -37,8 +38,9 @@ bool cmOSXBundleGenerator::MustSkip()
void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
std::string& outpath)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
// Compute bundle directory names.
std::string out = outpath;
@@ -64,8 +66,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
const std::string& outpath)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
assert(this->MacContentFolders);
@@ -92,8 +95,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
plist.c_str());
// Generate Versions directory only for MacOSX frameworks
- if (this->Makefile->PlatformIsAppleIos())
+ if (this->Makefile->PlatformIsAppleIos()) {
return;
+ }
// TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to
// drive rules to create these files at build time.
@@ -162,8 +166,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName,
const std::string& root)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
// Compute bundle directory names.
std::string out = root;
@@ -186,8 +191,9 @@ void cmOSXBundleGenerator::GenerateMacOSXContentStatements(
std::vector<cmSourceFile const*> const& sources,
MacOSXContentGeneratorType* generator)
{
- if (this->MustSkip())
+ if (this->MustSkip()) {
return;
+ }
for (std::vector<cmSourceFile const*>::const_iterator si = sources.begin();
si != sources.end(); ++si) {
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 10c68d1..26cbfb6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -228,14 +228,16 @@ std::string cmSystemTools::HelpFileName(std::string name)
std::string cmSystemTools::TrimWhitespace(const std::string& s)
{
std::string::const_iterator start = s.begin();
- while (start != s.end() && cm_isspace(*start))
+ while (start != s.end() && cm_isspace(*start)) {
++start;
- if (start == s.end())
+ }
+ if (start == s.end()) {
return "";
-
+ }
std::string::const_iterator stop = s.end() - 1;
- while (cm_isspace(*stop))
+ while (cm_isspace(*stop)) {
--stop;
+ }
return std::string(start, stop + 1);
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index da2a649..55da611 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -287,8 +287,9 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(
{
std::map<std::string, cmListFileBacktrace>::const_iterator i =
this->UtilityBacktraces.find(u);
- if (i == this->UtilityBacktraces.end())
+ if (i == this->UtilityBacktraces.end()) {
return 0;
+ }
return &i->second;
}