Fix line lengths to be no more than 78

This commit is contained in:
Ben Boeckel 2010-09-16 11:49:58 -04:00
parent e49a935c20
commit f117423336
4 changed files with 26 additions and 14 deletions

View File

@ -131,8 +131,10 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
if(this->WarnUninitialized && !this->Makefile->VariableInitialized(var)) if(this->WarnUninitialized && !this->Makefile->VariableInitialized(var))
{ {
if (this->CheckSystemVars || if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeDirectory()) || cmSystemTools::IsSubDirectory(this->FileName,
cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeOutputDirectory())) this->Makefile->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(this->FileName,
this->Makefile->GetHomeOutputDirectory()))
{ {
cmOStringStream msg; cmOStringStream msg;
msg << this->FileName << ":" << this->FileLine << ":" << msg << this->FileName << ":" << this->FileLine << ":" <<

View File

@ -1649,7 +1649,8 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
#endif #endif
this->Internal->VarStack.top().Set(name, value); this->Internal->VarStack.top().Set(name, value);
if ((this->Internal->VarUsageStack.size() > 1) && this->VariableInitialized(name)) if ((this->Internal->VarUsageStack.size() > 1) &&
this->VariableInitialized(name))
{ {
this->CheckForUnused("changing definition", name); this->CheckForUnused("changing definition", name);
this->Internal->VarUsageStack.top().erase(name); this->Internal->VarUsageStack.top().erase(name);
@ -1719,7 +1720,8 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
void cmMakefile::AddDefinition(const char* name, bool value) void cmMakefile::AddDefinition(const char* name, bool value)
{ {
this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); this->Internal->VarStack.top().Set(name, value? "ON" : "OFF");
if ((this->Internal->VarUsageStack.size() > 1) && this->VariableInitialized(name)) if ((this->Internal->VarUsageStack.size() > 1) &&
this->VariableInitialized(name))
{ {
this->CheckForUnused("changing definition", name); this->CheckForUnused("changing definition", name);
this->Internal->VarUsageStack.top().erase(name); this->Internal->VarUsageStack.top().erase(name);
@ -1742,7 +1744,8 @@ void cmMakefile::MarkVariableAsUsed(const char* var)
bool cmMakefile::VariableInitialized(const char* var) const bool cmMakefile::VariableInitialized(const char* var) const
{ {
if(this->Internal->VarInitStack.top().find(var) != this->Internal->VarInitStack.top().end()) if(this->Internal->VarInitStack.top().find(var) !=
this->Internal->VarInitStack.top().end())
{ {
return true; return true;
} }
@ -1751,7 +1754,8 @@ bool cmMakefile::VariableInitialized(const char* var) const
bool cmMakefile::VariableUsed(const char* var) const bool cmMakefile::VariableUsed(const char* var) const
{ {
if(this->Internal->VarUsageStack.top().find(var) != this->Internal->VarUsageStack.top().end()) if(this->Internal->VarUsageStack.top().find(var) !=
this->Internal->VarUsageStack.top().end())
{ {
return true; return true;
} }
@ -1773,8 +1777,10 @@ bool cmMakefile::CheckForUnused(const char* reason, const char* name)
{ {
const cmListFileContext* file = this->CallStack.back().Context; const cmListFileContext* file = this->CallStack.back().Context;
if (this->CheckSystemVars || if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(file->FilePath.c_str(), this->GetHomeDirectory()) || cmSystemTools::IsSubDirectory(file->FilePath.c_str(),
cmSystemTools::IsSubDirectory(file->FilePath.c_str(), this->GetHomeOutputDirectory())) this->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(file->FilePath.c_str(),
this->GetHomeOutputDirectory()))
{ {
cmOStringStream msg; cmOStringStream msg;
msg << file->FilePath << ":" << file->Line << ":" << msg << file->FilePath << ":" << file->Line << ":" <<

View File

@ -643,12 +643,14 @@ void cmake::SetArgs(const std::vector<std::string>& args)
} }
else if(arg.find("--no-warn-unused-cli",0) == 0) else if(arg.find("--no-warn-unused-cli",0) == 0)
{ {
std::cout << "Not finding unused variables given on the command line.\n"; std::cout << "Not searching for unused variables given on the " <<
"command line.\n";
this->SetWarnUnusedCli(false); this->SetWarnUnusedCli(false);
} }
else if(arg.find("--check-system-vars",0) == 0) else if(arg.find("--check-system-vars",0) == 0)
{ {
std::cout << "Also check system files when warning about unused and uninitialized variables.\n"; std::cout << "Also check system files when warning about unused and " <<
"uninitialized variables.\n";
this->SetCheckSystemVars(true); this->SetCheckSystemVars(true);
} }
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)

View File

@ -125,10 +125,12 @@ static const char * cmDocumentationOptions[][3] =
{"--warn-unused-vars", "Warn about unused variables.", {"--warn-unused-vars", "Warn about unused variables.",
"Find variables that are declared or set, but not used."}, "Find variables that are declared or set, but not used."},
{"--no-warn-unused-cli", "Don't warn about command line options.", {"--no-warn-unused-cli", "Don't warn about command line options.",
"Don't find variables that are declared on the command line, but not used."}, "Don't find variables that are declared on the command line, but not "
{"--check-system-vars", "Find problems with variable usage in system files.", "used."},
"Normally, unused and uninitialized variables are searched for only in CMAKE_SOURCE_DIR " {"--check-system-vars", "Find problems with variable usage in system "
"and CMAKE_BINARY_DIR. This flag tells CMake to warn about other files as well."}, "files.", "Normally, unused and uninitialized variables are searched for "
"only in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to "
"warn about other files as well."},
{"--help-command cmd [file]", "Print help for a single command and exit.", {"--help-command cmd [file]", "Print help for a single command and exit.",
"Full documentation specific to the given command is displayed. " "Full documentation specific to the given command is displayed. "
"If a file is specified, the documentation is written into and the output " "If a file is specified, the documentation is written into and the output "