[Cmake-commits] CMake branch, next, updated. v3.2.2-2897-g0bf0824
Brad King
brad.king at kitware.com
Mon May 18 11:17:06 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 0bf0824211883e7d1e652de1f7c85e1563ce2513 (commit)
via 3a65606591818281ba75bac4751e07c69751451f (commit)
from 69ad6cbdeb72d03e60437908be01ced30dd8ac6a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bf0824211883e7d1e652de1f7c85e1563ce2513
commit 0bf0824211883e7d1e652de1f7c85e1563ce2513
Merge: 69ad6cb 3a65606
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon May 18 11:17:04 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon May 18 11:17:04 2015 -0400
Merge topic 'fix-function-missing-endforeach' into next
3a656065 Fix assertion failure on unmatched foreach in function (#15572)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a65606591818281ba75bac4751e07c69751451f
commit 3a65606591818281ba75bac4751e07c69751451f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon May 18 10:31:42 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon May 18 11:13:05 2015 -0400
Fix assertion failure on unmatched foreach in function (#15572)
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track
nested loop levels in CMake language with a stack of counters,
2014-11-18) forgot to account for scopes popped by error messages about
unclosed scopes. Teach the error handler to pop the lexical scope it
reports as unclosed. Re-order the lexical scope RAII object to be
inside the variable scope RAII object scope so that the lexical scope
is fully closed before we check assertions about variable scopes.
Extend the RunCMake.Syntax test with a case covering this.
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index c33048c..4a0efc1 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -94,8 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
}
// we push a scope on the makefile
- cmMakefile::LexicalPushPop lexScope(this->Makefile);
cmMakefile::ScopePushPop varScope(this->Makefile);
+ cmMakefile::LexicalPushPop lexScope(this->Makefile);
static_cast<void>(varScope);
// Push a weak policy scope which restores the policies recorded at
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ba914e1..61a175c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3284,6 +3284,7 @@ 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)
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt
new file mode 100644
index 0000000..f4ff709
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Error at FunctionUnmatchedForeach.cmake:[0-9]+ \(f\):
+ A logical block opening on the line
+
+ .*/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake:[0-9]+ \(foreach\)
+
+ is not closed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake
new file mode 100644
index 0000000..ee9c184
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake
@@ -0,0 +1,5 @@
+function(f)
+ foreach(i 1)
+ #endforeach() # missing
+endfunction()
+f()
diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt
new file mode 100644
index 0000000..820cd2e
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Error at MacroUnmatchedForeach.cmake:[0-9]+ \(m\):
+ A logical block opening on the line
+
+ .*/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake:[0-9]+ \(foreach\)
+
+ is not closed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake
new file mode 100644
index 0000000..be443dd
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake
@@ -0,0 +1,5 @@
+macro(m)
+ foreach(i 1)
+ #endforeach() # missing
+endmacro()
+m()
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index cecd338..c431280 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -108,3 +108,7 @@ run_cmake(CMP0053-NameWithNewlineQuoted)
run_cmake(CMP0053-NameWithCarriageReturnQuoted)
run_cmake(CMP0053-NameWithEscapedSpacesQuoted)
run_cmake(CMP0053-NameWithEscapedTabsQuoted)
+
+# Function and macro tests.
+run_cmake(FunctionUnmatchedForeach)
+run_cmake(MacroUnmatchedForeach)
-----------------------------------------------------------------------
Summary of changes:
Source/cmFunctionCommand.cxx | 2 +-
Source/cmMakefile.cxx | 1 +
.../FunctionUnmatchedForeach-result.txt} | 0
Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt | 8 ++++++++
Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake | 5 +++++
.../MacroUnmatchedForeach-result.txt} | 0
Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt | 8 ++++++++
Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake | 5 +++++
Tests/RunCMake/Syntax/RunCMakeTest.cmake | 4 ++++
9 files changed, 32 insertions(+), 1 deletion(-)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => Syntax/FunctionUnmatchedForeach-result.txt} (100%)
create mode 100644 Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt
create mode 100644 Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => Syntax/MacroUnmatchedForeach-result.txt} (100%)
create mode 100644 Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt
create mode 100644 Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list