Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements checker.
This commit is contained in:
parent
bd9e551c1a
commit
a16bf141bc
|
@ -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;
|
||||
|
|
|
@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
|
|||
|
||||
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
|
||||
{
|
||||
if (Generator)
|
||||
if (Generator) {
|
||||
Generator->WriteGeneratedByToStrim(xout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -15,15 +15,15 @@ int main(int ac, char** av)
|
|||
std::string logarg;
|
||||
bool nextarg = false;
|
||||
|
||||
if (exename.find("valgrind") != exename.npos)
|
||||
if (exename.find("valgrind") != exename.npos) {
|
||||
logarg = "--log-file=";
|
||||
else if (exename.find("purify") != exename.npos)
|
||||
} else if (exename.find("purify") != exename.npos) {
|
||||
#ifdef _WIN32
|
||||
logarg = "/SAVETEXTDATA=";
|
||||
#else
|
||||
logarg = "-log-file=";
|
||||
#endif
|
||||
else if (exename.find("BC") != exename.npos) {
|
||||
} else if (exename.find("BC") != exename.npos) {
|
||||
nextarg = true;
|
||||
logarg = "/X";
|
||||
}
|
||||
|
@ -34,8 +34,9 @@ int main(int ac, char** av)
|
|||
std::string arg = argv[i];
|
||||
if (arg.find(logarg) == 0) {
|
||||
if (nextarg) {
|
||||
if (i == argc - 1)
|
||||
if (i == argc - 1) {
|
||||
return 1; // invalid command line
|
||||
}
|
||||
logfile = argv[i + 1];
|
||||
} else {
|
||||
logfile = arg.substr(logarg.length());
|
||||
|
@ -44,8 +45,9 @@ int main(int ac, char** av)
|
|||
}
|
||||
}
|
||||
|
||||
if (!logfile.empty())
|
||||
if (!logfile.empty()) {
|
||||
cmSystemTools::Touch(logfile, true);
|
||||
}
|
||||
}
|
||||
|
||||
return RETVAL;
|
||||
|
|
|
@ -46,10 +46,12 @@ private:
|
|||
void ParseTranslationUnit()
|
||||
{
|
||||
this->Command = CommandType();
|
||||
if (!Expect('{'))
|
||||
if (!Expect('{')) {
|
||||
return;
|
||||
if (Expect('}'))
|
||||
}
|
||||
if (Expect('}')) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
ParseString();
|
||||
std::string name = this->String;
|
||||
|
@ -64,8 +66,9 @@ private:
|
|||
void ParseString()
|
||||
{
|
||||
this->String = "";
|
||||
if (!Expect('"'))
|
||||
if (!Expect('"')) {
|
||||
return;
|
||||
}
|
||||
while (!Expect('"')) {
|
||||
Expect('\\');
|
||||
this->String.append(1, C);
|
||||
|
@ -84,8 +87,9 @@ private:
|
|||
|
||||
void ExpectOrDie(char c, const std::string& message)
|
||||
{
|
||||
if (!Expect(c))
|
||||
if (!Expect(c)) {
|
||||
ErrorExit(std::string("'") + c + "' expected " + message + ".");
|
||||
}
|
||||
}
|
||||
|
||||
void NextNonWhitespace()
|
||||
|
@ -98,8 +102,9 @@ private:
|
|||
void Next()
|
||||
{
|
||||
this->C = char(Input->get());
|
||||
if (this->Input->bad())
|
||||
if (this->Input->bad()) {
|
||||
ErrorExit("Unexpected end of file.");
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorExit(const std::string& message)
|
||||
|
|
Loading…
Reference in New Issue