summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx28
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4fb4579..47e1731 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -391,7 +391,7 @@ cmMakefile::IncludeScope::~IncludeScope()
this->EnforceCMP0011();
}
}
- this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->PopSnapshot(this->ReportError);
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
}
@@ -505,7 +505,7 @@ public:
~ListFileScope()
{
- this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->PopSnapshot(this->ReportError);
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
}
@@ -1534,7 +1534,7 @@ void cmMakefile::PopFunctionScope(bool reportError)
{
this->PopPolicy();
- this->PopPolicyBarrier(reportError);
+ this->PopSnapshot(reportError);
this->PopFunctionBlockerBarrier(reportError);
@@ -1565,7 +1565,7 @@ void cmMakefile::PushMacroScope(std::string const& fileName,
void cmMakefile::PopMacroScope(bool reportError)
{
this->PopPolicy();
- this->PopPolicyBarrier(reportError);
+ this->PopSnapshot(reportError);
this->PopFunctionBlockerBarrier(reportError);
}
@@ -1602,7 +1602,7 @@ public:
~BuildsystemFileScope()
{
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
- this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->PopSnapshot(this->ReportError);
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PopFileScope();
#endif
@@ -4168,9 +4168,7 @@ void cmMakefile::PopScope()
this->CheckForUnusedVariables();
- this->StateSnapshot =
- this->GetState()->Pop(this->StateSnapshot);
- assert(this->StateSnapshot.IsValid());
+ this->PopSnapshot();
}
void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
@@ -4521,20 +4519,15 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
//----------------------------------------------------------------------------
-cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak,
- cmPolicies::PolicyMap const& pm):
- Makefile(m), ReportError(true)
+cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m): Makefile(m)
{
- this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState()
- ->CreatePolicyScopeSnapshot(this->Makefile->StateSnapshot);
- this->Makefile->PushPolicy(weak, pm);
+ this->Makefile->PushPolicy();
}
//----------------------------------------------------------------------------
cmMakefile::PolicyPushPop::~PolicyPushPop()
{
this->Makefile->PopPolicy();
- this->Makefile->PopPolicyBarrier(this->ReportError);
}
//----------------------------------------------------------------------------
@@ -4554,8 +4547,11 @@ void cmMakefile::PopPolicy()
}
//----------------------------------------------------------------------------
-void cmMakefile::PopPolicyBarrier(bool reportError)
+void cmMakefile::PopSnapshot(bool reportError)
{
+ // cmState::Snapshot manages nested policy scopes within it.
+ // Since the scope corresponding to the snapshot is closing,
+ // reject any still-open nested policy scopes with an error.
while (!this->StateSnapshot.CanPopPolicyScope())
{
if(reportError)