mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
Fix assertion failure on unmatched function or macro
The fix in commit v3.2.3~3^2 (Fix assertion failure on unmatched foreach in function, 2015-05-18) broke handling of unmatched non-loop blocks because it assumed all function blockers removed during error unwinding were for loops, essentially switching the set of mishandled cases. The purpose of the loop block push/pop operations is to define a scope matching the lifetime of the loop function blockers. Since our function blockers already have the proper lifetime, simply move the push/pop operations to their constructor/destructor. Extend the RunCMake.Syntax test with a case covering this.
This commit is contained in:
@@ -3284,7 +3284,6 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
|
||||
this->FunctionBlockerBarriers.back();
|
||||
while(this->FunctionBlockers.size() > barrier)
|
||||
{
|
||||
cmMakefile::LoopBlockPop loopBlockPop(this);
|
||||
cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back());
|
||||
this->FunctionBlockers.pop_back();
|
||||
if(reportError)
|
||||
|
||||
Reference in New Issue
Block a user