Commit Graph

192 Commits

Author SHA1 Message Date
Brad King ef1d34b20d Merge topic 'parse-large-int'
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7698
2022-09-21 10:12:11 -04:00
Brad King 31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers 2022-09-20 12:00:08 -04:00
Marc Chevrier 02c067dee5 cm::enum_set: fix various bugs 2022-08-22 16:25:53 +02:00
Matthew Woehlke f2ef60ca54 cmArgumentParser: Ignore positional after keyword
Tweak cmArgumentParser to ignore positional arguments once a keyword
argument has been seen. This prevents mingling of keyword arguments
being able to effectively skip positional arguments, with later
arguments being picked up again; this seems highly likely to lead to
user confusion. This is also consistent with how other languages (e.g.
Python) handle a mix of "named" and positional arguments.
2022-08-17 11:03:51 -04:00
Brad King 7ca8d9f0f8 cmArgumentParser: Model non-empty strings with wrapper type
Some clients have been explicitly checking whether the string specified
after a keyword is empty.  Offer them a way to specify that the string
must be non-empty as part of the binding type.
2022-07-28 08:24:47 -04:00
Brad King 236bacc244 cmArgumentParser: Offer bindings for positional arguments 2022-07-27 07:03:32 -04:00
Brad King 1f2eb63d1c cmArgumentParser: Add callback bindings 2022-07-27 07:03:32 -04:00
Brad King 77fcb00a2b cmArgumentParser: Propagate constructors through binding wrapper types 2022-07-27 07:03:31 -04:00
Brad King f7e81802f2 cmArgumentParser: Offer binding for list of parsed keywords
Some clients ask for this list in their `Parse()` call.
Offer them a way to express this request as a binding.
2022-07-25 13:52:01 -04:00
Brad King f95a5832c7 cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()
All clients have been converted to encoding this requirement in their
bindings.
2022-07-25 13:51:43 -04:00
Brad King b7c82b26b0 cmArgumentParser: Capture keyword errors in parse results
Since commit f46b2e9142 (cmArgumentParser: Model maybe-missing string
with wrapper type, 2022-07-06) we know during parsing whether or not it
is an error for a keyword to be missing a value.  Record such errors in
the parse results structure.  Offer clients a helper method to report
them.  This provides clients with an alternative to manually checking
`keywordsMissingValue` and generating their own error message.
2022-07-22 10:32:24 -04:00
Brad King 50876f6b9a cmArgumentParser: Add structure to capture operational results
Create a way for the parser to record errors or incidental information
about the argument parsing operation that clients can inspect afterward.
Offer clients a way to hold the structure as part of their arguments
structure.
2022-07-22 10:32:18 -04:00
Brad King f46b2e9142 cmArgumentParser: Model maybe-missing string with wrapper type
Bindings to `std::string` require one value.  Some clients have been
filtering `keywordsMissingValue` to support keywords that tolerate a
missing value.  Offer them a type-safe way to achieve this instead.
2022-07-07 09:49:04 -04:00
Brad King e6d1e29ffa cmArgumentParser: Model maybe-empty and non-empty lists with wrapper types
Previously bindings to `std::vector<std::string>` required at least one
value.  Some clients have been filtering `keywordsMissingValue` to
support keywords followed by empty lists.  Instead, require clients to
specify whether a keyword's list can be empty as part of the binding
type.
2022-07-07 09:48:58 -04:00
Brad King 0a4c5164c9 cmArgumentParser: Offer cm::optional bindings to capture keyword presence
Several clients have been using `keywordsMissingValue` or
`parsedKeywords` to check for the presence of keywords.  Offer them a
type-encoded way to explicitly check whether a keyword is present.
2022-07-05 16:35:01 -04:00
Brad King 1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
Ben Boeckel 6ff03d463f clang-tidy: address google-readability-casting lints
At least those involving `static_cast`.
2022-05-24 09:09:43 -04:00
Martin Duffy 30336dab66 cmJSONHelpers: Restructure cmJSONHelpers
Restructure cmJSONHelpers to prevent SunPro errors when passing context.
2022-05-05 12:12:12 -04:00
Marc Chevrier b13eef5a90 cm::enum_set: container that contains a set of unique enum values.
The enum must be an `enum class` with an unsigned integer as base type.
2022-04-27 19:40:40 +02:00
Brad King 3055b202ec Merge topic 'builtin-help-versionadded'
054754359a cmRST: support `versionadded` and `versionchanged` directives

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6667
2021-10-28 09:09:24 -04:00
Ben Boeckel 054754359a cmRST: support versionadded and versionchanged directives
This makes `versionadded` and `versionchanged` directives show up in
`cmake --help-*` output instead of disappearing (and potentially making
empty sections).

Fixes: #22808
2021-10-27 09:15:00 -04:00
Sean McBride 1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Brad King 09f4edbcef Fix Clang -Wbitwise-instead-of-logical warnings 2021-10-13 10:00:08 -04:00
Sean McBride 907d098838 Source: Fix clang -Wextra-semi warnings 2021-09-28 09:59:24 -04:00
Brad King b6c4d93dcd clang-analyzer: Suppress warnings in intentional use-after-move cases 2021-06-03 14:59:55 -04:00
Josef Angstenberger e4a856f8b9 Tests: Fix typos and spelling in test error message 2021-05-07 17:00:14 +02:00
Ben Boeckel 808b17b120 clang-tidy: fix readability-make-member-function-const warnings 2021-01-27 08:45:45 -05:00
Brad King 7d498d6b43 Utilities/Sphinx: Add role and directive for 'genex' in CMake domain
This enables cross-reference syntax for CMake generator expressions:

    :genex:`SOME_GENEX`
    :genex:`$<SOME_GENEX>`
    :genex:`$<SOME_GENEX:...>`

and definition of CMake generator expressions via a directive:

    .. genex:: SOME_GENEX
    .. genex:: $<SOME_GENEX>
    .. genex:: $<SOME_GENEX:...>

It also adds generator expressions defined by the directive and by
`Help/genex/SOME_GENEX.rst` documents to the index.
2021-01-18 12:35:41 -05:00
Brad King 621ba5e1f2 cmRST: Add support for 'envvar' directive
This was accidentally left out of commit 8acf46caf1 (Utilities/Sphinx:
Add role and directive for 'envvar' in CMake domain, 2018-04-19,
v3.12.0-rc1~200^2~1).
2021-01-18 12:35:40 -05:00
Oleksandr Koval 209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Eicke Herbertz 8c42cfb2e8 test/CMakeLib: make testUVProcessChain work with qemu
When building and testing CMake in a container with qemu
user mode emulation, the expected termination with std::abort()
in testUVProcessChainHelper leads qemu to emit an additional
message about an uncaught signal. There appears to be no way
to make qemu shut up, so any qemu message will be removed
from the output during validation.
2020-10-29 19:52:54 +01:00
Kyle Edwards 0668120398 cm::optional: Fix move assignment 2020-10-21 14:23:43 -04:00
Kyle Edwards 946adadd40 cmGccDepfileReader: Rework helper code
Fix some of the semantics of the depfile, add error handling, and
refactor cmGccDepfileLexerHelper.
2020-10-13 10:18:02 -04:00
Kyle Edwards 06c0d59c17 IWYU: Map <*> headers to <cm/*> headers
For headers which exclusively contain things that were not present
in C++11.
2020-10-08 13:40:21 -04:00
Kyle Edwards 3059e6aed7 cmJSONHelpers: Add new Bind() function 2020-10-05 09:49:59 -04:00
Marc Chevrier 82c9508313 cmake_path: enhancements
* Fix error on parsing "c:a" (root-name without root-directory)
* Enrich documentation
2020-09-20 15:17:34 +02:00
Kyle Edwards 3f3a30e1e0 JSON: Add helpers 2020-09-09 08:29:02 -04:00
Kyle Edwards e366977e62 Merge topic 'cmstrlen'
0c9cdf30ed cmStringAlgorithms: Add cmStrLen()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5201
2020-09-09 08:21:26 -04:00
Kyle Edwards 0c9cdf30ed cmStringAlgorithms: Add cmStrLen() 2020-09-08 10:15:54 -04:00
Kyle Edwards 7e1304c6e6 cm::optional: Add comparison operators 2020-09-07 08:50:09 -04:00
Kyle Edwards c854e9eba5 Refactor: Add ASSERT_TRUE() macro to testOptional.cxx 2020-09-06 17:39:27 -04:00
Brad King 9fc8e827c8 Tests: Fix -Wsuggest-destructor-override warning in testCMExtMemory 2020-07-28 10:06:31 -04:00
Jean-Christophe Fillion-Robin 207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Brad King 2282be37a5 Merge topic 'stl-support-filesystem-path'
d654bf3449 STL Support: Add cm::filesystem::path in <cm/filesystem>
e5798126fc STL Support: introduce dedicated configuration file
4408f34cfe STL Support: Add function cm::quoted in <cm/iomanip>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4968
2020-07-13 07:59:43 -04:00
Tobias Ribizel f38e4a1871 Tests: Add cases for CTest cuda-memcheck parser 2020-07-09 19:08:34 +02:00
Marc Chevrier d654bf3449 STL Support: Add cm::filesystem::path in <cm/filesystem> 2020-07-09 17:02:42 +02:00
Marc Chevrier 2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Brad King 68a59ab288 Merge topic 'stl-support'
8d4a9ee398 Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4689
2020-05-01 08:27:37 -04:00
Marc Chevrier 8d4a9ee398 Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view> 2020-04-30 09:53:27 +02:00
Ben Boeckel 99663a5157 IWYU: mark <cstddef> as needed
Newer IWYU is not seeing this as necessary for `_GLIBCXX_USE_CXX11_ABI`.
2020-04-29 11:16:44 -04:00