Commit Graph

41 Commits

Author SHA1 Message Date
Brad King 38ee28bfd5 Merge branch 'fix-function-missing-end' into release 2015-06-22 11:46:09 -04:00
Brad King 5d85fb4f40 Fix assertion failure on unmatched function or macro
The fix in commit v3.2.3~3^2 (Fix assertion failure on unmatched foreach
in function, 2015-05-18) broke handling of unmatched non-loop blocks
because it assumed all function blockers removed during error unwinding
were for loops, essentially switching the set of mishandled cases.

The purpose of the loop block push/pop operations is to define a scope
matching the lifetime of the loop function blockers.  Since our function
blockers already have the proper lifetime, simply move the push/pop
operations to their constructor/destructor.

Extend the RunCMake.Syntax test with a case covering this.
2015-06-22 11:41:51 -04:00
Stephen Kelly ad16747927 foreach: Remove unused variables. 2015-05-24 11:09:59 +02:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Gregor Jasny 0de867dde2 continue: Add a new CMake language command for loop continuation (#14013)
Inspired-by: Doug Barbieri
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-12-01 09:50:49 -05:00
Gregor Jasny bae604d9a8 Track nested loop levels in CMake language with a stack of counters
It gets incremented while entering a loop block (e.g. foreach or while)
and gets decremented when leaving the block. Because scope borders for
example at function borders must be taken into account the counter is
put into a stack. With every new scope an empty counter is pushed on the
stack, when leaving the scope the original value is restored.

This will allow easy querying if the break command is properly nested
within a loop scope.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-11-25 14:14:15 -05:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Bill Hoffman 0a7ec1a4b6 BUG: fix for #9014, FATAL_ERROR not ending loops 2009-05-13 11:08:29 -04:00
Brad King ecb0f3af55 ENH: New foreach(<var> IN ...) mode
This creates a new mode of the foreach command which allows precise
iteration even over empty elements.  This mode may be safely extended
with more keyword arguments in the future.  The cost now is possibly
breaking scripts that iterate over a list of items beginning with 'IN',
but there is no other way to extend the syntax in a readable way.
2009-03-17 15:10:15 -04:00
Brad King 1dcc5b4558 ENH: Better handling of mismatched blocks
If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command).  The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command.  Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.

This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch.  The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.
2009-01-21 09:49:00 -05:00
Brad King bca1026250 ENH: Better error message for unclosed blocks
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.).  We record the line at which each
block is opened so it can be reported in the error message.
2009-01-21 09:48:20 -05:00
Brad King 2c81e5fb5c ENH: Refactor function blocker deletion
When a function blocker decides to remove itself we previously removed
it at every return point from the C++ scope in which its removal is
needed.  This teaches function blockers to transfer ownership of
themselves from cmMakefile to an automatic variable for deletion on
return.  Since this removes blockers before they replay their commands,
we no longer need to avoid running blockers on their own commands.
2009-01-20 14:36:18 -05:00
Bill Hoffman f386c2aae0 ENH: make CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS the default and remove the property. If any value is specified in an endif, endforeach, endwhile, etc then make sure it matches the start string. If no values are given then it is no longer an error. 2008-02-29 12:18:11 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Ken Martin 27379d7b08 ENH: make properties a bit more formal with documentation and chaining 2006-12-07 09:45:32 -05:00
Ken Martin c88c75b8f2 ENH: reduce string construct delete ops 2006-05-31 11:19:39 -04:00
Ken Martin 29a03db7ce ENH: allow loose loop constructs 2006-05-18 13:50:01 -04:00
Ken Martin 2af4710525 STYLE: fix line length 2006-05-10 15:46:45 -04:00
Ken Martin d81ebf0c23 ENH: added support for -SP scripts in new processes 2006-04-04 13:04:28 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Ken Martin dec5cc1082 ENH: converted macro to use variables and fixed some case issues with some function blockers 2005-06-23 11:03:57 -04:00
Ken Martin de89c6fa69 COMP: fix possible poroblem with freed memory 2005-06-22 14:16:18 -04:00
Ken Martin 6e6bfc752b COMP: fix unused variable 2005-06-22 14:04:52 -04:00
Ken Martin f5dbca4971 ENH: changed FOREACH to use variables instead of string replacement 2005-06-22 13:32:11 -04:00
Andy Cedilnik f188d46431 BUG: Propagate file name and line number inside FOREACH. Fixes Bug #1169 - Erro messages inside FOREACH have bad filename and line number 2004-09-15 13:31:20 -04:00
Brad King b6da1d1271 ENH: Added support for special variables CMAKE_CURRENT_LIST_FILE and CMAKE_CURRENT_LIST_LINE that evaluate to the file name and line number in which they appear. This implements the feature request from bug 1012. 2004-08-04 10:45:11 -04:00
Ken Martin 79fcc81b6a better error checking for FOREACH 2004-05-12 14:32:25 -04:00
Andy Cedilnik 8750f1c277 ENH: Add RANGE support to FOREACH 2004-04-29 15:12:40 -04:00
Ken Martin b56dcc2a30 perf improvement 2003-06-23 16:26:48 -04:00
Brad King 4888c088ae ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside. 2002-12-11 18:13:33 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Ken Martin 7ddb408621 removed some includes 2002-09-27 16:24:10 -04:00
Ken Martin fcc410de44 fixed if statements inside a foreach 2002-07-17 10:48:39 -04:00
Sebastien Barre c617091d13 ENH: support semi-colon format (list of args as string) 2002-03-25 16:24:13 -05:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Bill Hoffman 0d3eefb1f1 new borland generator moved into place 2001-11-30 16:48:52 -05:00
Bill Hoffman 41017cbc88 ENH: clean up warnings 2001-11-13 12:38:53 -05:00
Bill Hoffman baa28efd10 ENH: change InitialPass to take a const reference to the argument string, to avoid changes to the file cache 2001-09-20 15:08:30 -04:00
Ken Martin f783252c62 new commands 2001-07-25 16:52:51 -04:00