On Tue, Nov 18, 2014 at 16:34:28 +0100, Gregor Jasny wrote:
> Changes compared to v4:
> * Use new style error reporting in cmContinueCommand.cxx
> * Reject any given arguments to continue()
> * CMP0055: Reject any arguments to break, too.
Untested, but from a (very) quick skim, I don't see anything wrong. I
thought of a test for break() while looking at it. I wonder if we should
fix anything about it and if so, make continue behave in an analogous
way before it might also need a policy[1]:
-------- loop.cmake ---------
function (my_breakf)
break()
endfunction ()
macro (my_breakm)
break()
endmacro ()
foreach (a IN ITEMS 1 2 3)
my_breakf()
message("-->${a}<--")
endforeach ()
foreach (a IN ITEMS 4 5 6)
my_breakm()
message("-->${a}<--")
endforeach ()
-------- loop.cmake ---------
Which prints:
-->1<--
-->2<--
-->3<--
without any error messages (e.g., about using break() outside a
loop…which doesn't seem to happen anyways, so maybe this is moot). I
don't see any existing tests about break inside of a function or macro
having an effect on the caller's logic.
Thoughts?
--Ben
[1]Though it might be better to fix, if necessary, both with one policy
so that they're always the same and there is no case where continue has
NEW behavior and break OLD behavior.
--
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