diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-16 17:53:41 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-16 17:53:41 (GMT) |
commit | ca90f673a0f162424bd6b1ab74e72439bad9c429 (patch) | |
tree | dbceb38479a194fdecc3b91a486a2c0b97ef52da /Source/cmMakefile.cxx | |
parent | f7438ca7ac62007aec39d0e9134d556607ccbff3 (diff) | |
download | CMake-ca90f673a0f162424bd6b1ab74e72439bad9c429.zip CMake-ca90f673a0f162424bd6b1ab74e72439bad9c429.tar.gz CMake-ca90f673a0f162424bd6b1ab74e72439bad9c429.tar.bz2 |
Fix detection of unused variables when setting
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1e12658..844b302 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1648,7 +1648,7 @@ void cmMakefile::AddDefinition(const char* name, const char* value) #endif this->Internal->VarStack.top().Set(name, value); - if ((this->Internal->VarUsageStack.size() > 1) && + if (this->Internal->VarUsageStack.size() && this->VariableInitialized(name)) { this->CheckForUnused("changing definition", name); @@ -1719,7 +1719,7 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value, void cmMakefile::AddDefinition(const char* name, bool value) { this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); - if ((this->Internal->VarUsageStack.size() > 1) && + if (this->Internal->VarUsageStack.size() && this->VariableInitialized(name)) { this->CheckForUnused("changing definition", name); @@ -1763,7 +1763,7 @@ bool cmMakefile::VariableUsed(const char* var) const void cmMakefile::CheckForUnused(const char* reason, const char* name) const { - if (this->WarnUnused && !this->VariableUsed(name)) + if (this->WarnUnused && !this->VariableUsed(name) && this->CallStack.size()) { const cmListFileContext* file = this->CallStack.back().Context; if (this->CheckSystemVars || |