summaryrefslogtreecommitdiffstats
path: root/Source/cmForEachCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Revise implementation of case-insensitive command namesFlorian Jacomme2018-05-221-3/+3
| | | | | | | | | | | | | | | | | | | | Store both the as-written and lower-case command names and use the latter to avoid case-insensitive string comparisons. With this I obtain 2-6% speed increase (on Windows) for the configure step with no significant changes in memory usage. A case-insensitive comparison is a lot slower than just calling `==` because the operator will use things like memcmp, so prefer the latter. The `cmSystemTools::LowerCase` function allocates a new string each time it is called, so before this change we were allocating in: * cmMakefile::Configure two times for each function (to look for `cmake_minimum_required` and `project`) * cmMakefile::ExecuteCommand twice by function by calling cmState::GetCommand and copying the name Now we are only allocating once by function instead of four.
* cmForEachCommand: prevent leakageMatthias Maennich2017-10-301-2/+3
|
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-4/+5
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-2/+2
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* cmExecutionStatus: Remove arguments from settersDaniel Pfeifer2017-05-091-1/+1
| | | | | The setters are only used to set boolean values. The values are never reset individually.
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-2/+8
|
* Separate compilation for commands included in cmBootstrapCommands1Daniel Pfeifer2016-10-211-0/+2
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Avoid else after returnDaniel Pfeifer2016-09-161-3/+2
|
* use empty method to check for emptynessDaniel Pfeifer2016-09-151-1/+1
|
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-4/+3
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-125/+86
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Merge topic 'fix-function-missing-end'Brad King2015-06-231-8/+14
|\ | | | | | | | | 5d85fb4f Fix assertion failure on unmatched function or macro
| * Fix assertion failure on unmatched function or macroBrad King2015-06-221-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | foreach: Remove unused variables.Stephen Kelly2015-05-241-2/+0
|/
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-2/+2
| | | | All compilers hosting CMake support the std class.
* continue: Add a new CMake language command for loop continuation (#14013)Gregor Jasny2014-12-011-0/+4
| | | | | Inspired-by: Doug Barbieri Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
* Track nested loop levels in CMake language with a stack of countersGregor Jasny2014-11-251-0/+8
| | | | | | | | | | | | | 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>
* Remove some c_str() calls.Stephen Kelly2014-03-111-8/+8
| | | | | | 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.
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-131-7/+7
| | | | | | | | | | | | | | | | | 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/ \+$//'
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | 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.
* BUG: fix for #9014, FATAL_ERROR not ending loopsBill Hoffman2009-05-131-0/+4
|
* ENH: New foreach(<var> IN ...) modeBrad King2009-03-171-0/+48
| | | | | | | | 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.
* ENH: Better handling of mismatched blocksBrad King2009-01-211-1/+2
| | | | | | | | | | | | | | | | 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.
* ENH: Better error message for unclosed blocksBrad King2009-01-211-9/+0
| | | | | | 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.
* ENH: Refactor function blocker deletionBrad King2009-01-201-11/+4
| | | | | | | | | 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.
* ENH: make CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS the default and remove the ↵Bill Hoffman2008-02-291-4/+4
| | | | 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.
* ENH: add return and break support to cmake, also change basic command ↵Ken Martin2008-01-231-4/+23
| | | | invocation signature to be able to return extra informaiton via the cmExecutionStatus class
* ENH: make properties a bit more formal with documentation and chainingKen Martin2006-12-071-1/+2
|
* ENH: reduce string construct delete opsKen Martin2006-05-311-3/+3
|
* ENH: allow loose loop constructsKen Martin2006-05-181-8/+19
|
* STYLE: fix line lengthKen Martin2006-05-101-1/+3
|
* ENH: added support for -SP scripts in new processesKen Martin2006-04-041-1/+1
|
* STYLE: some m_ to this-> cleanupKen Martin2006-03-151-21/+21
|
* ENH: converted macro to use variables and fixed some case issues with some ↵Ken Martin2005-06-231-2/+2
| | | | function blockers
* COMP: fix possible poroblem with freed memoryKen Martin2005-06-221-2/+6
|
* COMP: fix unused variableKen Martin2005-06-221-3/+0
|
* ENH: changed FOREACH to use variables instead of string replacementKen Martin2005-06-221-18/+7
|
* BUG: Propagate file name and line number inside FOREACH. Fixes Bug #1169 - ↵Andy Cedilnik2004-09-151-0/+2
| | | | Erro messages inside FOREACH have bad filename and line number
* ENH: Added support for special variables CMAKE_CURRENT_LIST_FILE and ↵Brad King2004-08-041-0/+2
| | | | 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.
* better error checking for FOREACHKen Martin2004-05-121-1/+2
|
* ENH: Add RANGE support to FOREACHAndy Cedilnik2004-04-291-1/+73
|
* perf improvementKen Martin2003-06-231-2/+5
|
* ENH: Moved ExpandListVariables out of individual commands. Argument ↵Brad King2002-12-111-48/+44
| | | | evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside.
* ENH: Added reference to Copyright.txt. Removed old reference to ITK ↵Brad King2002-10-231-4/+4
| | | | copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs.
* removed some includesKen Martin2002-09-271-1/+0
|
* fixed if statements inside a foreachKen Martin2002-07-171-1/+7
|
* ENH: support semi-colon format (list of args as string)Sebastien Barre2002-03-251-1/+4
|
* ENH:Updated copyrightWill Schroeder2002-01-211-29/+5
|