[cmake-developers] [PATCH v4 0/3] Add continue keyword

Gregor Jasny gjasny at googlemail.com
Mon Nov 17 14:00:51 EST 2014


Hello,

the current version now properly checks for proper nesting
of the continue keyword. To detect new scope blocks like
for example a function() I hoked into the Push/PopScope
functions.

I have some questions:
1) The Scope variable stack is held in a 'internal' structure
  that gets special treatment in the cmMakefile copy ctor.
  I don't know the implications of storing my loop block
  counter stack directly as member of cmMakefile. Could you
  please advise?

2) The error message for an inproperly nested continue looks
  like this:

  continue A CONTINUE command was found outside of a proper FOREACH or WHILE
  loop scope.

  where is the continue coming from? Is it part of a (too short)
  call stack trace? Also I noticed that the CMakeFile is still
  processed after the error is shown. Is this desired behavior?

3) The continue tests have a requirement for CMake version 3.1
  in the CMakeLists.txt file. This needs to be bumped to 3.2 once
  the the version number got incremented to 3.2.

4) Is the new policy to reject misplaced break() commands really
  necessary?

Thanks,
Gregor

https://github.com/gjasny/CMake/commits/feature/14013-continue-keyword
*** BLURB HERE ***

Gregor Jasny (3):
  Add continue keyword (#14013)
  Reject continue() without loop block (#14013)
  Reject break() without loop scope

 Help/command/continue.rst                          |  7 +++
 Help/manual/cmake-policies.7.rst                   |  1 +
 Help/policy/CMP0055.rst                            | 17 +++++++
 Source/cmBootstrapCommands1.cxx                    |  2 +
 Source/cmBreakCommand.cxx                          | 33 +++++++++++++
 Source/cmContinueCommand.cxx                       | 28 +++++++++++
 Source/cmContinueCommand.h                         | 55 ++++++++++++++++++++++
 Source/cmExecutionStatus.h                         |  7 +++
 Source/cmForEachCommand.cxx                        | 12 +++++
 Source/cmIfCommand.cxx                             |  5 ++
 Source/cmMakefile.cxx                              | 48 +++++++++++++++++++
 Source/cmMakefile.h                                | 21 +++++++++
 Source/cmPolicies.cxx                              |  5 ++
 Source/cmPolicies.h                                |  1 +
 Source/cmWhileCommand.cxx                          |  8 ++++
 Tests/RunCMake/CMP0055/CMP0055-NEW-result.txt      |  1 +
 Tests/RunCMake/CMP0055/CMP0055-NEW-stderr.txt      |  4 ++
 Tests/RunCMake/CMP0055/CMP0055-NEW.cmake           |  4 ++
 Tests/RunCMake/CMP0055/CMP0055-OLD-result.txt      |  1 +
 Tests/RunCMake/CMP0055/CMP0055-OLD-stderr.txt      |  1 +
 Tests/RunCMake/CMP0055/CMP0055-OLD.cmake           |  4 ++
 Tests/RunCMake/CMP0055/CMP0055-WARN-result.txt     |  1 +
 Tests/RunCMake/CMP0055/CMP0055-WARN-stderr.txt     |  9 ++++
 Tests/RunCMake/CMP0055/CMP0055-WARN.cmake          |  2 +
 Tests/RunCMake/CMP0055/CMakeLists.txt              |  3 ++
 Tests/RunCMake/CMP0055/RunCMakeTest.cmake          |  5 ++
 Tests/RunCMake/CMakeLists.txt                      |  3 ++
 Tests/RunCMake/continue/CMakeLists.txt             |  3 ++
 .../RunCMake/continue/ContinueForEachInLists.cmake | 10 ++++
 Tests/RunCMake/continue/ContinueForeach-stdout.txt |  4 ++
 Tests/RunCMake/continue/ContinueForeach.cmake      |  8 ++++
 .../continue/ContinueNestedForeach-stdout.txt      |  6 +++
 .../RunCMake/continue/ContinueNestedForeach.cmake  | 13 +++++
 Tests/RunCMake/continue/ContinueWhile-stdout.txt   |  6 +++
 Tests/RunCMake/continue/ContinueWhile.cmake        | 10 ++++
 .../RunCMake/continue/NoEnclosingBlock-result.txt  |  1 +
 .../RunCMake/continue/NoEnclosingBlock-stderr.txt  |  2 +
 Tests/RunCMake/continue/NoEnclosingBlock.cmake     |  1 +
 .../continue/NoEnclosingBlockInFunction-result.txt |  1 +
 .../continue/NoEnclosingBlockInFunction-stderr.txt |  2 +
 .../continue/NoEnclosingBlockInFunction.cmake      |  8 ++++
 Tests/RunCMake/continue/RunCMakeTest.cmake         |  8 ++++
 Tests/RunCMake/return/CMakeLists.txt               |  3 ++
 Tests/RunCMake/return/ReturnFromForeach-result.txt |  1 +
 Tests/RunCMake/return/ReturnFromForeach.cmake      | 10 ++++
 Tests/RunCMake/return/RunCMakeTest.cmake           |  3 ++
 46 files changed, 388 insertions(+)
 create mode 100644 Help/command/continue.rst
 create mode 100644 Help/policy/CMP0055.rst
 create mode 100644 Source/cmContinueCommand.cxx
 create mode 100644 Source/cmContinueCommand.h
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-NEW-result.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-NEW.cmake
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-result.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-OLD.cmake
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-WARN-result.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0055/CMP0055-WARN.cmake
 create mode 100644 Tests/RunCMake/CMP0055/CMakeLists.txt
 create mode 100644 Tests/RunCMake/CMP0055/RunCMakeTest.cmake
 create mode 100644 Tests/RunCMake/continue/CMakeLists.txt
 create mode 100644 Tests/RunCMake/continue/ContinueForEachInLists.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueForeach-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueForeach.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueNestedForeach-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueNestedForeach.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueWhile-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueWhile.cmake
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlock-result.txt
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlock-stderr.txt
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlock.cmake
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlockInFunction-result.txt
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlockInFunction-stderr.txt
 create mode 100644 Tests/RunCMake/continue/NoEnclosingBlockInFunction.cmake
 create mode 100644 Tests/RunCMake/continue/RunCMakeTest.cmake
 create mode 100644 Tests/RunCMake/return/CMakeLists.txt
 create mode 100644 Tests/RunCMake/return/ReturnFromForeach-result.txt
 create mode 100644 Tests/RunCMake/return/ReturnFromForeach.cmake
 create mode 100644 Tests/RunCMake/return/RunCMakeTest.cmake

-- 
1.9.3 (Apple Git-50)



More information about the cmake-developers mailing list