Signed-off-by: Gregor Jasny <[email protected]>
---
Source/cmContinueCommand.cxx | 12 +++++++++++-
Tests/RunCMake/continue/NoArgumentsToContinue-result.txt | 1 +
Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt | 1 +
Tests/RunCMake/continue/NoArgumentsToContinue.cmake | 3 +++
Tests/RunCMake/continue/RunCMakeTest.cmake | 1 +
5 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 Tests/RunCMake/continue/NoArgumentsToContinue-result.txt
create mode 100644 Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
create mode 100644 Tests/RunCMake/continue/NoArgumentsToContinue.cmake
diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx
index 8b249c2..ce70dd6 100644
--- a/Source/cmContinueCommand.cxx
+++ b/Source/cmContinueCommand.cxx
@@ -12,7 +12,7 @@
#include "cmContinueCommand.h"
// cmContinueCommand
-bool cmContinueCommand::InitialPass(std::vector<std::string> const&,
+bool cmContinueCommand::InitialPass(std::vector<std::string> const &args,
cmExecutionStatus &status)
{
if(!this->Makefile->IsLoopBlock())
@@ -25,6 +25,16 @@ bool cmContinueCommand::InitialPass(std::vector<std::string>
const&,
}
status.SetContinueInvoked(true);
+
+ if(!args.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "The CONTINUE command does not accept any "
+ "arguments.");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+
return true;
}
diff --git a/Tests/RunCMake/continue/NoArgumentsToContinue-result.txt
b/Tests/RunCMake/continue/NoArgumentsToContinue-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/continue/NoArgumentsToContinue-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
b/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
new file mode 100644
index 0000000..d968a62
--- /dev/null
+++ b/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
@@ -0,0 +1 @@
+ The CONTINUE command does not accept any arguments.
diff --git a/Tests/RunCMake/continue/NoArgumentsToContinue.cmake
b/Tests/RunCMake/continue/NoArgumentsToContinue.cmake
new file mode 100644
index 0000000..609804d
--- /dev/null
+++ b/Tests/RunCMake/continue/NoArgumentsToContinue.cmake
@@ -0,0 +1,3 @@
+foreach(i RANGE 1 2)
+ continue(1)
+endforeach()
diff --git a/Tests/RunCMake/continue/RunCMakeTest.cmake
b/Tests/RunCMake/continue/RunCMakeTest.cmake
index f85154f..37caf9c 100644
--- a/Tests/RunCMake/continue/RunCMakeTest.cmake
+++ b/Tests/RunCMake/continue/RunCMakeTest.cmake
@@ -4,5 +4,6 @@ run_cmake(ContinueForeach)
run_cmake(ContinueForEachInLists)
run_cmake(ContinueNestedForeach)
run_cmake(ContinueWhile)
+run_cmake(NoArgumentsToContinue)
run_cmake(NoEnclosingBlock)
run_cmake(NoEnclosingBlockInFunction)
--
1.9.3 (Apple Git-50)
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers