diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-22 16:40:43 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-22 16:46:15 (GMT) |
commit | c6e7fabc0f3563a258b8b3e10757e1916d680db0 (patch) | |
tree | 76ae6ba820dfdb7771ae304e2e630db4c83fcb6a /Source/cmMakefile.cxx | |
parent | 5e41ba8e4a25bec2b5d7c175f80a1ace0999a8ff (diff) | |
download | CMake-c6e7fabc0f3563a258b8b3e10757e1916d680db0.zip CMake-c6e7fabc0f3563a258b8b3e10757e1916d680db0.tar.gz CMake-c6e7fabc0f3563a258b8b3e10757e1916d680db0.tar.bz2 |
Factor out the checks for unused variables
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a9faa6b..5aa643c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -178,15 +178,9 @@ bool cmMakefile::NeedCacheCompatibility(int major, int minor) cmMakefile::~cmMakefile() { - std::set<cmStdString> usage = this->Internal->VarUsageStack.top(); - std::set<cmStdString>::const_iterator it = usage.begin(); - for (; it != usage.end(); ++it) - { - if (!this->VariableUsed(it->c_str())) - { - this->CheckForUnused("out of scope", it->c_str()); - } - } + // Check for unused variables + this->CheckForUnusedVariables(); + for(std::vector<cmInstallGenerator*>::iterator i = this->InstallGenerators.begin(); i != this->InstallGenerators.end(); ++i) @@ -713,6 +707,9 @@ bool cmMakefile::ReadListFile(const char* filename_in, // pop the listfile off the stack this->ListFileStack.pop_back(); + // Check for unused variables + this->CheckForUnusedVariables(); + return true; } @@ -1751,6 +1748,17 @@ void cmMakefile::AddDefinition(const char* name, bool value) #endif } +void cmMakefile::CheckForUnusedVariables() const +{ + const cmDefinitions& defs = this->Internal->VarStack.top(); + const std::set<cmStdString>& locals = defs.LocalKeys(); + std::set<cmStdString>::const_iterator it = locals.begin(); + for (; it != locals.end(); ++it) + { + this->CheckForUnused("out of scope", it->c_str()); + } +} + void cmMakefile::MarkVariableAsUsed(const char* var) { this->Internal->VarUsageStack.top().insert(var); |