1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-21 23:00:50 +08:00
Commit Graph

11 Commits

Author SHA1 Message Date
Martin Duffy
f134468a98 JSON: Improve JSON error message formatting
This improves the output of JSON-related error messages. It adds the filename to
the output and excludes the column number.

This is particularly useful when there are multiple JSON files being read that
could be responsible for an error, ie CMakePresets.json and
CMakeUserPresets.json, or multiple instrumentation queries.

Issue: #26717
2025-03-13 10:44:31 -04:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* 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.

Issue: #26123
2025-01-23 13:09:50 -05:00
Alex Turbov
0c17cc9ef5 cmJSONHelpers.h: Add FilteredObject helper
Iterate over the object's members and call a filter callable to decide what
to do with the current key/value. A filter returns one of the `FilterResult`
values. A container type is an associative or a sequence container of pairs
(key, value).

Refactor `MapFilter()` and `Map()` to use `FilteredObject()`. Moreover,
for C++ >= 17 implementation is more optimized depending on the given filter
object type and capable of detecting and properly calling the filter callable
using 1 or 3 arguments, up to totally eliminate any checking (even dummy)
in the generated code.

Supported container types, used to append key/value items, aren't limited to
`std::map` only and can be any associative container or a sequenced one with
pairs of key/value as elements.
2024-08-26 19:01:48 +04:00
Alex Turbov
cc20644c71 testCommon.h: Introduce ASSERT_EQUAL(actual, expected) macro
Performs `==` on given arguments and print an error if they are
not equal also printing their values.

Both arguments must be printable to `std::ostream`!
2024-08-21 02:24:16 +04:00
Alex Turbov
c553be501d CMakeLibTests: Use runTests
Also, improve it a little.
2024-08-14 01:31:46 +04:00
Alex Turbov
0146fca12d CMakeLibTests: include testCommon.h for ASSERT_TRUE
And remove duplicate definitions.
2024-08-14 01:04:15 +04:00
Martin Duffy
19305afd8a presets: Improve JSON parser and error messages 2023-03-29 10:41:19 -04:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 15.

* 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.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Martin Duffy
30336dab66 cmJSONHelpers: Restructure cmJSONHelpers
Restructure cmJSONHelpers to prevent SunPro errors when passing context.
2022-05-05 12:12:12 -04:00
Kyle Edwards
3059e6aed7 cmJSONHelpers: Add new Bind() function 2020-10-05 09:49:59 -04:00
Kyle Edwards
3f3a30e1e0 JSON: Add helpers 2020-09-09 08:29:02 -04:00