summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2010-09-15 15:41:27 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-09-15 15:41:27 (GMT)
commite49a935c20550482e9f92ceb05d1f2a0bc519c91 (patch)
treef96bef5f6819982bb1e5743aca1812accdcf4b35 /Source/cmMakefile.cxx
parente01e40cb87f464dd5b1d5ca1c8f0884f573c1b72 (diff)
downloadCMake-e49a935c20550482e9f92ceb05d1f2a0bc519c91.zip
CMake-e49a935c20550482e9f92ceb05d1f2a0bc519c91.tar.gz
CMake-e49a935c20550482e9f92ceb05d1f2a0bc519c91.tar.bz2
Improve unused warning logic
Only warn when changing the definition of an initialized variable.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 85a0ccc..9d5c59e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1649,12 +1649,12 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
#endif
this->Internal->VarStack.top().Set(name, value);
- this->Internal->VarInitStack.top().insert(name);
- if (this->Internal->VarUsageStack.size() > 1)
+ if ((this->Internal->VarUsageStack.size() > 1) && this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
this->Internal->VarUsageStack.top().erase(name);
}
+ this->Internal->VarInitStack.top().insert(name);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
@@ -1719,12 +1719,12 @@ 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");
- this->Internal->VarInitStack.top().insert(name);
- if (this->Internal->VarUsageStack.size() > 1)
+ if ((this->Internal->VarUsageStack.size() > 1) && this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
this->Internal->VarUsageStack.top().erase(name);
}
+ this->Internal->VarInitStack.top().insert(name);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )