Fix the Ubuntu CI failures of the unity test build

- build unit-noexcept.cpp on its own: it suppresses GCC's -Wnoexcept
  around its include of the library, which has no effect once another
  file of the batch included the library first
- unit-comparison.cpp: make make_unordered_object inline
  (-Wmissing-prototypes in a named namespace) and replace the
  using-directive by using-declarations, as Clang reports a
  using-directive in an #include-d file (-Wheader-hygiene)
- unit-json_pointer-cpp20.cpp: include <compare> only with
  JSON_HAS_THREE_WAY_COMPARISON; GCC 9 and Clang 9 accept C++20 but
  have no <compare>

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-10 05:43:28 +02:00
1 parent 020a834128
commit 169f1fcb2d
3 files changed
+18 -6

No files matched your search

+5 -3
View File
@@ -416,9 +416,11 @@ function(json_test_add_unity_tests)
endforeach()
# files that must not be merged into a batch: unit-32bit.cpp is only built
# for 32bit targets, and unit-no-macro-leak.cpp checks that including the
# library defines no unprefixed macro, which any other file would disturb
set(standalone_files unit-32bit.cpp unit-no-macro-leak.cpp)
# for 32bit targets, unit-no-macro-leak.cpp checks that including the
# library defines no unprefixed macro, which any other file would disturb,
# and unit-noexcept.cpp suppresses GCC's -Wnoexcept around its include of
# the library, which has no effect once another file included it first
set(standalone_files unit-32bit.cpp unit-no-macro-leak.cpp unit-noexcept.cpp)
set(harmless_macros "^(DOCTEST_.*|SKIP_TESTS_FOR_.*|JSON_TEST_DEPRECATED_FUNCTIONS_DELETED|JSON_TEST_STRICT_NUL_HANDLING_ENABLED|JSON_TEST_STRINGIZE)$")