Rename find-unused to warn-unused

This commit is contained in:
Ben Boeckel 2010-08-25 12:36:21 -04:00
parent d7999e9b29
commit 4ff03402fc
5 changed files with 19 additions and 19 deletions

View File

@ -92,7 +92,7 @@ cmMakefile::cmMakefile(): Internal(new Internals)
this->AddDefaultDefinitions(); this->AddDefaultDefinitions();
this->Initialize(); this->Initialize();
this->PreOrder = false; this->PreOrder = false;
this->FindUnused = false; this->WarnUnused = false;
this->DefaultToUsed = false; this->DefaultToUsed = false;
} }
@ -136,7 +136,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
this->SubDirectoryOrder = mf.SubDirectoryOrder; this->SubDirectoryOrder = mf.SubDirectoryOrder;
this->Properties = mf.Properties; this->Properties = mf.Properties;
this->PreOrder = mf.PreOrder; this->PreOrder = mf.PreOrder;
this->FindUnused = mf.FindUnused; this->WarnUnused = mf.WarnUnused;
this->DefaultToUsed = mf.DefaultToUsed; this->DefaultToUsed = mf.DefaultToUsed;
this->ListFileStack = mf.ListFileStack; this->ListFileStack = mf.ListFileStack;
this->Initialize(); this->Initialize();
@ -766,9 +766,9 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
{ {
const cmDefinitions& defs = cmDefinitions(); const cmDefinitions& defs = cmDefinitions();
const std::set<cmStdString> globalKeys = defs.LocalKeys(); const std::set<cmStdString> globalKeys = defs.LocalKeys();
this->FindUnused = this->GetCMakeInstance()->GetFindUnused(); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->DefaultToUsed = this->GetCMakeInstance()->GetDefaultToUsed(); this->DefaultToUsed = this->GetCMakeInstance()->GetDefaultToUsed();
if (this->FindUnused) if (this->WarnUnused)
{ {
this->Internal->VarUsageStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys);
} }
@ -1710,7 +1710,7 @@ 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");
this->Internal->VarInitStack.top().insert(name); this->Internal->VarInitStack.top().insert(name);
if (this->FindUnused && this->DefaultToUsed) if (this->WarnUnused && this->DefaultToUsed)
{ {
this->Internal->VarUsageStack.top().insert(name); this->Internal->VarUsageStack.top().insert(name);
} }
@ -1756,7 +1756,7 @@ void cmMakefile::RemoveDefinition(const char* name)
this->Internal->VarStack.top().Set(name, 0); this->Internal->VarStack.top().Set(name, 0);
this->Internal->VarRemoved.insert(name); this->Internal->VarRemoved.insert(name);
this->Internal->VarInitStack.top().insert(name); this->Internal->VarInitStack.top().insert(name);
if (this->FindUnused) if (this->WarnUnused)
{ {
this->Internal->VarUsageStack.top().insert(name); this->Internal->VarUsageStack.top().insert(name);
} }
@ -2138,7 +2138,7 @@ const char* cmMakefile::GetDefinition(const char* name) const
RecordPropertyAccess(name,cmProperty::VARIABLE); RecordPropertyAccess(name,cmProperty::VARIABLE);
} }
#endif #endif
if (this->FindUnused) if (this->WarnUnused)
{ {
this->Internal->VarUsageStack.top().insert(name); this->Internal->VarUsageStack.top().insert(name);
} }
@ -3391,7 +3391,7 @@ void cmMakefile::PopScope()
for (; it != locals.end(); ++it) for (; it != locals.end(); ++it)
{ {
init.erase(*it); init.erase(*it);
if (this->FindUnused && usage.find(*it) == usage.end()) if (this->WarnUnused && usage.find(*it) == usage.end())
{ {
cmOStringStream m; cmOStringStream m;
m << "unused variable \'" << *it << "\'"; m << "unused variable \'" << *it << "\'";

View File

@ -934,7 +934,7 @@ private:
bool PreOrder; bool PreOrder;
// Unused variable flags // Unused variable flags
bool FindUnused; bool WarnUnused;
bool DefaultToUsed; bool DefaultToUsed;
// stack of list files being read // stack of list files being read

View File

@ -141,7 +141,7 @@ cmake::cmake()
{ {
this->Trace = false; this->Trace = false;
this->WarnUninitialized = false; this->WarnUninitialized = false;
this->FindUnused = false; this->WarnUnused = false;
this->DefaultToUsed = false; this->DefaultToUsed = false;
this->SuppressDevWarnings = false; this->SuppressDevWarnings = false;
this->DoSuppressDevWarnings = false; this->DoSuppressDevWarnings = false;
@ -621,16 +621,16 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::cout << "Warn about uninitialized values.\n"; std::cout << "Warn about uninitialized values.\n";
this->SetWarnUninitialized(true); this->SetWarnUninitialized(true);
} }
else if(arg.find("--find-unused",0) == 0) else if(arg.find("--warn-unused",0) == 0)
{ {
std::cout << "Finding unused command line variables.\n"; std::cout << "Finding unused command line variables.\n";
this->SetFindUnused(true); this->SetWarnUnused(true);
this->SetDefaultToUsed(true); this->SetDefaultToUsed(true);
} }
else if(arg.find("--find-unused-all",0) == 0) else if(arg.find("--warn-unused-all",0) == 0)
{ {
std::cout << "Finding unused variables.\n"; std::cout << "Finding unused variables.\n";
this->SetFindUnused(true); this->SetWarnUnused(true);
this->SetDefaultToUsed(false); this->SetDefaultToUsed(false);
} }
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)

View File

@ -308,8 +308,8 @@ class cmake
void SetTrace(bool b) { this->Trace = b;} void SetTrace(bool b) { this->Trace = b;}
bool GetWarnUninitialized() { return this->WarnUninitialized;} bool GetWarnUninitialized() { return this->WarnUninitialized;}
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
bool GetFindUnused() { return this->FindUnused;} bool GetWarnUnused() { return this->WarnUnused;}
void SetFindUnused(bool b) { this->FindUnused = b;} void SetWarnUnused(bool b) { this->WarnUnused = b;}
bool GetDefaultToUsed() { return this->DefaultToUsed;} bool GetDefaultToUsed() { return this->DefaultToUsed;}
void SetDefaultToUsed(bool b) { this->DefaultToUsed = b;} void SetDefaultToUsed(bool b) { this->DefaultToUsed = b;}
// Define a property // Define a property
@ -450,7 +450,7 @@ private:
bool DebugOutput; bool DebugOutput;
bool Trace; bool Trace;
bool WarnUninitialized; bool WarnUninitialized;
bool FindUnused; bool WarnUnused;
bool DefaultToUsed; bool DefaultToUsed;
std::string CMakeEditCommand; std::string CMakeEditCommand;
std::string CMakeCommand; std::string CMakeCommand;

View File

@ -122,9 +122,9 @@ static const char * cmDocumentationOptions[][3] =
"message(send_error ) calls."}, "message(send_error ) calls."},
{"--warn-uninitialized", "Warn about uninitialized values.", {"--warn-uninitialized", "Warn about uninitialized values.",
"Print a warning when an uninitialized variable is used."}, "Print a warning when an uninitialized variable is used."},
{"--find-unused", "Find unused variables.", {"--warn-unused", "Warn about unused variables.",
"Find variables that are declared on the command line, but not used."}, "Find variables that are declared on the command line, but not used."},
{"--find-unused-all", "Find all unused variables.", {"--warn-unused-all", "Warn about all unused variables.",
"Find variables that are declared, but not used."}, "Find variables that are declared, but not used."},
{"--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. "