Add flags to detect unused variables
This commit is contained in:
parent
f332e14ff2
commit
d3e8eb5041
|
@ -141,6 +141,8 @@ cmake::cmake()
|
||||||
{
|
{
|
||||||
this->Trace = false;
|
this->Trace = false;
|
||||||
this->StrictMode = false;
|
this->StrictMode = false;
|
||||||
|
this->FindUnused = false;
|
||||||
|
this->DefaultToUsed = false;
|
||||||
this->SuppressDevWarnings = false;
|
this->SuppressDevWarnings = false;
|
||||||
this->DoSuppressDevWarnings = false;
|
this->DoSuppressDevWarnings = false;
|
||||||
this->DebugOutput = false;
|
this->DebugOutput = false;
|
||||||
|
@ -619,6 +621,18 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
||||||
std::cout << "Running in strict mode.\n";
|
std::cout << "Running in strict mode.\n";
|
||||||
this->SetStrictMode(true);
|
this->SetStrictMode(true);
|
||||||
}
|
}
|
||||||
|
else if(arg.find("--find-unused",0) == 0)
|
||||||
|
{
|
||||||
|
std::cout << "Finding unused command line variables.\n";
|
||||||
|
this->SetFindUnused(true);
|
||||||
|
this->SetDefaultToUsed(true);
|
||||||
|
}
|
||||||
|
else if(arg.find("--find-unused-all",0) == 0)
|
||||||
|
{
|
||||||
|
std::cout << "Finding unused variables.\n";
|
||||||
|
this->SetFindUnused(true);
|
||||||
|
this->SetDefaultToUsed(false);
|
||||||
|
}
|
||||||
else if(arg.find("-G",0) == 0)
|
else if(arg.find("-G",0) == 0)
|
||||||
{
|
{
|
||||||
std::string value = arg.substr(2);
|
std::string value = arg.substr(2);
|
||||||
|
|
|
@ -308,6 +308,10 @@ class cmake
|
||||||
void SetTrace(bool b) { this->Trace = b;}
|
void SetTrace(bool b) { this->Trace = b;}
|
||||||
bool GetStrictMode() { return this->StrictMode;}
|
bool GetStrictMode() { return this->StrictMode;}
|
||||||
void SetStrictMode(bool b) { this->StrictMode = b;}
|
void SetStrictMode(bool b) { this->StrictMode = b;}
|
||||||
|
bool GetFindUnused() { return this->FindUnused;}
|
||||||
|
void SetFindUnused(bool b) { this->FindUnused = b;}
|
||||||
|
bool GetDefaultToUsed() { return this->DefaultToUsed;}
|
||||||
|
void SetDefaultToUsed(bool b) { this->DefaultToUsed = b;}
|
||||||
// Define a property
|
// Define a property
|
||||||
void DefineProperty(const char *name, cmProperty::ScopeType scope,
|
void DefineProperty(const char *name, cmProperty::ScopeType scope,
|
||||||
const char *ShortDescription,
|
const char *ShortDescription,
|
||||||
|
@ -446,6 +450,8 @@ private:
|
||||||
bool DebugOutput;
|
bool DebugOutput;
|
||||||
bool Trace;
|
bool Trace;
|
||||||
bool StrictMode;
|
bool StrictMode;
|
||||||
|
bool FindUnused;
|
||||||
|
bool DefaultToUsed;
|
||||||
std::string CMakeEditCommand;
|
std::string CMakeEditCommand;
|
||||||
std::string CMakeCommand;
|
std::string CMakeCommand;
|
||||||
std::string CXXEnvironment;
|
std::string CXXEnvironment;
|
||||||
|
|
|
@ -123,6 +123,10 @@ static const char * cmDocumentationOptions[][3] =
|
||||||
{"--strict-mode", "Put cmake in strict mode.",
|
{"--strict-mode", "Put cmake in strict mode.",
|
||||||
"In strict mode cmake will print a warning when an uninitialized variable "
|
"In strict mode cmake will print a warning when an uninitialized variable "
|
||||||
"is used."},
|
"is used."},
|
||||||
|
{"--find-unused", "Find unused variables.",
|
||||||
|
"Find variables that are declared on the command line, but not used."},
|
||||||
|
{"--find-unused-all", "Find all unused variables.",
|
||||||
|
"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. "
|
||||||
"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 "
|
||||||
|
|
Loading…
Reference in New Issue