continue() fails to work inside a macro
According to the documentation, return(), break() and continue() should work in a macro since macros are textual-replacement based. The documentation even explicitly uses return() as an example of something that if placed inside a macro will actually get injected into the calling code where the macro is invoked.
However, continue() doesn't work at all in this situation.
My use case is a little cmake based parser for a CMake syntax sweetener I'm developing. In the parsing state machine, it's super useful to employ macros for code duplication between states. In various checks that run in each state that are packaged in macro form, I tried to use continue() to move to the next cycle in the state machine loop once I've found out what token I'm dealing with and dealt with it. This fails because continue() gets entirely ignored when inside macro code it would seem. That's unfortunate.
Here's a simplified example to show the bug:
macro(tryToContinue)
continue()
endmacro()
set(ctr 0)
while(ctr LESS 8)
math(EXPR ctr "${ctr} + 1")
if(ctr EQUAL 3)
tryToContinue()
endif()
message(${ctr})
endwhile()
should print 1, 2, 4, 5, 6, 7, skipping 3. Fails to actually continue() so 3 is printed.