[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.528 1.529
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Nov 2 11:56:19 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv18481/Source
Modified Files:
cmMakefile.cxx
Log Message:
Warn on set(PARENT_SCOPE) at top scope
Previously we silently ignored such calls and set nothing. The commit
"Initialize directory scope with closure of parent" inroduced a bad test
for the top scope. This commit fixes the test to avoid dereferencing a
null pointer, and adds a warning when the case is encountered.
Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.528
retrieving revision 1.529
diff -C 2 -d -r1.528 -r1.529
*** cmMakefile.cxx 8 Oct 2009 18:56:15 -0000 1.528
--- cmMakefile.cxx 2 Nov 2009 16:56:17 -0000 1.529
***************
*** 3389,3400 ****
up->Set(var, varDef);
}
! else if(cmMakefile* parent =
! this->LocalGenerator->GetParent()->GetMakefile())
{
// Update the definition in the parent directory top scope. This
// directory's scope was initialized by the closure of the parent
// scope, so we do not need to localize the definition first.
parent->Internal->VarStack.top().Set(var, varDef);
}
}
--- 3389,3406 ----
up->Set(var, varDef);
}
! else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
{
// Update the definition in the parent directory top scope. This
// directory's scope was initialized by the closure of the parent
// scope, so we do not need to localize the definition first.
+ cmMakefile* parent = plg->GetMakefile();
parent->Internal->VarStack.top().Set(var, varDef);
}
+ else
+ {
+ cmOStringStream m;
+ m << "Cannot set \"" << var << "\": current scope has no parent.";
+ this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
+ }
}
More information about the Cmake-commits
mailing list