summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Source sweep: Replace std::ostringstream when used with a single appendSebastian Holtermann2019-08-231-3/+1
| | | | | | | This replaces `std::ostringstream`, when it is written to only once. If the single written argument was numeric, `std::to_string` is used instead. Otherwise, the single written argument is used directly instead of the `std::ostringstream::str()` invocation.
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenizeSebastian Holtermann2019-08-051-3/+4
| | | | | | | | | | This adds the following functions to `cmStringAlgorithms`: - `cmIsSpace` - `cmTrimWhitespace` (moved from `cmSystemTools::TrimWhitespace`) - `cmEscapeQuotes` (moved from `cmSystemTools::EscapeQuotes`) - `cmTokenize` (moved from `cmSystemTools::tokenize` and adapted to accept `cm::string_view`)
* cmake: Enable --warn-uninitialized inside string(CONFIGURE) and configure_fileArtur Ryt2018-12-291-2/+4
| | | | Fixes: #18489
* cmCommandArgumentParserHelper: use cmMakefile::MaybeWarnUninitializedArtur Ryt2018-12-291-20/+1
| | | | | It removes logic duplication and need to have cached WarnUninitialized and CheckSystemVars
* Merge topic 'gicv-stdstring'Brad King2018-09-121-3/+3
|\ | | | | | | | | | | | | 13d10ee616 cmState::GetInitializedCacheValue: Return as const std::string* Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2365
| * cmState::GetInitializedCacheValue: Return as const std::string*Vitaly Stakhovsky2018-09-101-3/+3
| |
* | Warnings: Remove unused variablesCraig Scott2018-09-111-1/+0
|/
* cmCommandArgumentParserHelper: Avoid -Wstringop-truncation warningBrad King2018-07-311-1/+1
| | | | | Use `memcpy` instead of `strncpy` to copy bytes from a buffer that may not be null terminated.
* Fix crash with --trace-expand --warn-uninitialized togetherR2RT2018-04-091-4/+5
| | | | | | | | Some code paths in `ExpandVariablesInString{New,Old}` were not checking the `filename` parameter for a null pointer, but this can happen when using the above flags together. Add the checks and a test case. Fixes: #17896
* cmCommandArgumentParser: remove the variable tokens from the classRolf Eike Beer2017-10-251-11/+4
| | | | Make them local constants in the lexer file.
* cmCommandArgumentParserHelper: constify some char* valuesRolf Eike Beer2017-10-251-11/+13
|
* Meta: replace empty-string assignments with `clear()`.Pavel Solodovnikov2017-09-151-2/+2
|
* 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.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-5/+5
|
* Use CM_DISABLE_COPYDaniel Pfeifer2017-04-241-1/+0
|
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* cmCommandArgumentParserHelper: remove unnecessary includeDaniel Pfeifer2017-03-291-2/+0
|
* 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.
* tidy: Fix readability-redundant-string-cstr issuesGregor Jasny2016-09-041-1/+1
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-2/+8
|
* CMake: don't use else after returnDaniel Pfeifer2016-08-181-8/+6
|
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-4/+4
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-5/+5
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-154/+111
| | | | | | | | | | | | | 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.
* Source: Sort includes the way clang-format wouldBrad King2016-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Re-apply the approach from commit e1c77472 (Format include directive blocks and ordering with clang-format, 2016-04-29) but this time be more careful about exclusion of parser generator sources: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '^Source/cmCommandArgumentLexer\.' | egrep -z -v '^Source/cmCommandArgumentParser\.' | egrep -z -v '^Source/cmDependsJavaLexer\.' | egrep -z -v '^Source/cmDependsJavaParser\.' | egrep -z -v '^Source/cmExprLexer\.' | egrep -z -v '^Source/cmExprParser\.' | egrep -z -v '^Source/cmFortranLexer\.' | egrep -z -v '^Source/cmFortranParser\.' | egrep -z -v '^Source/cmListFileLexer\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i Also drop use of custom sorting for `sys/types.h`.
* Add call stack to unused/uninitialized variable warningsBrad King2016-04-151-8/+1
| | | | | | | | In commit v2.8.4~32^2~14 (Use cmake::IssueMessage for warnings, 2010-12-07) these warnings became formatted. It is more informative to give the full call stack with such warnings. Also it is easier to implement warnings with a full call stack because we do not have to construct a custom backtrace with only the top.
* cmCommandArgumentParserHelper: Port to cmOutputConverter.Stephen Kelly2015-06-061-3/+4
|
* cmake: Add IssueMessage overload taking a single cmListFileContext.Stephen Kelly2015-05-211-4/+5
| | | | Port appropriate clients to use it.
* cmListFileBacktrace: Hide the context-stack implementation detail.Stephen Kelly2015-05-181-1/+1
| | | | | | The backtrace will soon not be implemented in terms of a stack of cmListFileContext objects. Keep the cmListFileContext in the API for convenience for now.
* Port to cmState.Stephen Kelly2015-04-131-1/+2
|
* cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.Stephen Kelly2015-04-071-1/+2
| | | | | Being initialized is a requirement for this method to return something, and is what differentiates it from using GetIterator with it.GetValue.
* Revert topic 'refactor-cache-api'Brad King2015-04-071-2/+1
| | | | | | This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic.
* cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.Stephen Kelly2015-04-061-1/+2
| | | | | Being initialized is a requirement for this method to return something, and is what differentiates it from using GetIterator with it.GetValue.
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-5/+5
| | | | All compilers hosting CMake support the std class.
* backtrace: Convert to local paths in IssueMessageBen Boeckel2014-06-051-1/+1
| | | | | This is the only place we care show the FilePath to the user, so defer the expensive relative path calculation until here.
* Remove c_str calls when using stream APIs.Stephen Kelly2014-03-111-1/+1
| | | | | Use an ad-hoc clang tool for matching the calls which should be ported.
* Remove some c_str() calls.Stephen Kelly2014-03-111-6/+6
| | | | | | 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.
* stringapi: Use strings for AddString methodsBen Boeckel2014-03-081-6/+6
| | | | It gets turned into a string anyways, so pass them in.
* Include cmMakefile.h before cm*Lexer.h to get stdint.h firstBrad King2013-08-071-2/+2
| | | | | | | Some generated cm*Lexer.h headers define preprocessor macros normally provided by <stdint.h>. The latter is included indrectly by cmMakefile.h since commit 2268c41a (Optimize custom command full-path dependency lookup, 2013-08-06). Adjust the order to avoid redefinition warnings.
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-131-5/+5
| | | | | | | | | | | | | | | | | 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/ \+$//'
* Use cmake::IssueMessage for warningsBen Boeckel2010-12-071-3/+8
|
* Use 'CMake Warning' versus 'warning' for CDashBen Boeckel2010-12-071-1/+1
|
* Fix long lines for KWStyleBen Boeckel2010-09-231-1/+1
|
* Fix line lengths to be no more than 78Ben Boeckel2010-09-161-2/+4
|
* Remove now unused variablesBen Boeckel2010-09-081-2/+0
|
* Use built-ins for readability and maintainabilityBen Boeckel2010-09-081-2/+3
|
* Fix detection of system filesBen Boeckel2010-09-021-2/+4
| | | | | Instead of looking to see if the file is under CMAKE_ROOT, check to see if it is instead under the source or binary directories in use.
* Add a flag to warn about system filesBen Boeckel2010-09-011-4/+10
|
* Rename strict-mode to warn-uninitializedBen Boeckel2010-09-011-3/+3
|