diff options
author | Brad King <brad.king@kitware.com> | 2014-11-26 18:50:47 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-11-26 18:50:47 (GMT) |
commit | 82582c96bd86969ee5e1cc6f7bc4e5b12e1717e1 (patch) | |
tree | 3b47d49ccd16f09b7281f16600d553ea8b44b630 /Source/cmMakefile.cxx | |
parent | 106c769f1d46a2410ff62c3dd4cd02cd1da7fd37 (diff) | |
parent | d54617d0068fc5acfa2079d1e8de8f38365564ab (diff) | |
download | CMake-82582c96bd86969ee5e1cc6f7bc4e5b12e1717e1.zip CMake-82582c96bd86969ee5e1cc6f7bc4e5b12e1717e1.tar.gz CMake-82582c96bd86969ee5e1cc6f7bc4e5b12e1717e1.tar.bz2 |
Merge topic 'break-command-strictness'
d54617d0 break: Add policy CMP0055 to check calls strictly
bae604d9 Track nested loop levels in CMake language with a stack of counters
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 61807b2..6eca0f0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -171,6 +171,9 @@ void cmMakefile::Initialize() // Protect the directory-level policies. this->PushPolicyBarrier(); + // push empty loop block + this->PushLoopBlockBarrier(); + // By default the check is not done. It is enabled by // cmListFileCache in the top level if necessary. this->CheckCMP0000 = false; @@ -3354,6 +3357,38 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) } //---------------------------------------------------------------------------- +void cmMakefile::PushLoopBlock() +{ + assert(!this->LoopBlockCounter.empty()); + this->LoopBlockCounter.top()++; +} + +void cmMakefile::PopLoopBlock() +{ + assert(!this->LoopBlockCounter.empty()); + assert(this->LoopBlockCounter.top() > 0); + this->LoopBlockCounter.top()--; +} + +void cmMakefile::PushLoopBlockBarrier() +{ + this->LoopBlockCounter.push(0); +} + +void cmMakefile::PopLoopBlockBarrier() +{ + assert(!this->LoopBlockCounter.empty()); + assert(this->LoopBlockCounter.top() == 0); + this->LoopBlockCounter.pop(); +} + +bool cmMakefile::IsLoopBlock() const +{ + assert(!this->LoopBlockCounter.empty()); + return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0; +} + +//---------------------------------------------------------------------------- bool cmMakefile::ExpandArguments( std::vector<cmListFileArgument> const& inArgs, std::vector<std::string>& outArgs) const @@ -4487,10 +4522,14 @@ void cmMakefile::PushScope() this->Internal->VarStack.push(cmDefinitions(parent)); this->Internal->VarInitStack.push(init); this->Internal->VarUsageStack.push(usage); + + this->PushLoopBlockBarrier(); } void cmMakefile::PopScope() { + this->PopLoopBlockBarrier(); + cmDefinitions* current = &this->Internal->VarStack.top(); std::set<std::string> init = this->Internal->VarInitStack.top(); std::set<std::string> usage = this->Internal->VarUsageStack.top(); |