commit 30d27df61c7758a948559cebfe5e3e6c9e1803b6 Author: Niels Lohmann Date: Thu Jul 31 20:10:57 2025 +0200 Fix CI (#4871) * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann * :construction_worker: fix CI Signed-off-by: Niels Lohmann --------- Signed-off-by: Niels Lohmann Index: nlohmann-json3/cmake/clang_flags.cmake =================================================================== --- nlohmann-json3.orig/cmake/clang_flags.cmake +++ nlohmann-json3/cmake/clang_flags.cmake @@ -6,6 +6,7 @@ # -Wno-padded We do not care about padding warnings. # -Wno-covered-switch-default All switches list all cases and a default case. # -Wno-unsafe-buffer-usage Otherwise Doctest would not compile. +# -Wno-missing-noreturn We found no way to silence this warning otherwise, see PR #4871 set(CLANG_CXXFLAGS -Werror @@ -17,4 +18,5 @@ set(CLANG_CXXFLAGS -Wno-padded -Wno-covered-switch-default -Wno-unsafe-buffer-usage + -Wno-missing-noreturn ) Index: nlohmann-json3/cmake/download_test_data.cmake =================================================================== --- nlohmann-json3.orig/cmake/download_test_data.cmake +++ nlohmann-json3/cmake/download_test_data.cmake @@ -1,21 +1,33 @@ set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data) set(JSON_TEST_DATA_VERSION 3.1.0) +include(ExternalProject) + # if variable is set, use test data from given directory rather than downloading them if(JSON_TestDataDirectory) message(STATUS "Using test data in ${JSON_TestDataDirectory}.") add_custom_target(download_test_data) file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n") else() - find_package(Git) + # create a header with the path to the downloaded test data + file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/test_files\"\n") + + # download test data from GitHub release + ExternalProject_Add(download_test_data_project + URL "${JSON_TEST_DATA_URL}/archive/refs/tags/v${JSON_TEST_DATA_VERSION}.zip" + SOURCE_DIR "${CMAKE_BINARY_DIR}/test_files" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD TRUE + DOWNLOAD_EXTRACT_TIMESTAMP TRUE + EXCLUDE_FROM_ALL TRUE + ) + # target to download test data add_custom_target(download_test_data - COMMAND test -d json_test_data || ${GIT_EXECUTABLE} clone -c advice.detachedHead=false --branch v${JSON_TEST_DATA_VERSION} ${JSON_TEST_DATA_URL}.git --quiet --depth 1 - COMMENT "Downloading test data from ${JSON_TEST_DATA_URL} (v${JSON_TEST_DATA_VERSION})" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS download_test_data_project ) - # create a header with the path to the downloaded test data - file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/json_test_data\"\n") endif() # determine the operating system (for debug and support purposes) Index: nlohmann-json3/include/nlohmann/detail/input/input_adapters.hpp =================================================================== --- nlohmann-json3.orig/include/nlohmann/detail/input/input_adapters.hpp +++ nlohmann-json3/include/nlohmann/detail/input/input_adapters.hpp @@ -401,7 +401,7 @@ template struct is_iterator_of_multibyte { using value_type = typename std::iterator_traits::value_type; - enum + enum // NOLINT(cppcoreguidelines-use-enum-class) { value = sizeof(value_type) > 1 }; Index: nlohmann-json3/include/nlohmann/detail/meta/type_traits.hpp =================================================================== --- nlohmann-json3.orig/include/nlohmann/detail/meta/type_traits.hpp +++ nlohmann-json3/include/nlohmann/detail/meta/type_traits.hpp @@ -655,7 +655,7 @@ struct is_ordered_map template static one test( decltype(&C::capacity) ) ; template static two test(...); - enum { value = sizeof(test(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) + enum { value = sizeof(test(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class) }; // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) Index: nlohmann-json3/single_include/nlohmann/json.hpp =================================================================== --- nlohmann-json3.orig/single_include/nlohmann/json.hpp +++ nlohmann-json3/single_include/nlohmann/json.hpp @@ -4192,7 +4192,7 @@ struct is_ordered_map template static one test( decltype(&C::capacity) ) ; template static two test(...); - enum { value = sizeof(test(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) + enum { value = sizeof(test(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class) }; // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) @@ -6888,7 +6888,7 @@ template struct is_iterator_of_multibyte { using value_type = typename std::iterator_traits::value_type; - enum + enum // NOLINT(cppcoreguidelines-use-enum-class) { value = sizeof(value_type) > 1 }; Index: nlohmann-json3/tests/src/unit-conversions.cpp =================================================================== --- nlohmann-json3.orig/tests/src/unit-conversions.cpp +++ nlohmann-json3/tests/src/unit-conversions.cpp @@ -1352,7 +1352,7 @@ TEST_CASE("value conversion") #ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION SECTION("get an enum") { - enum c_enum { value_1, value_2 }; + enum c_enum { value_1, value_2 }; // NOLINT(cppcoreguidelines-use-enum-class) enum class cpp_enum { value_1, value_2 }; CHECK(json(value_1).get() == value_1); @@ -1601,7 +1601,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(cards, {cards::karo, "karo"} }) -enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value) +enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value,cppcoreguidelines-use-enum-class) { TS_STOPPED, TS_RUNNING, Index: nlohmann-json3/tests/src/unit-noexcept.cpp =================================================================== --- nlohmann-json3.orig/tests/src/unit-noexcept.cpp +++ nlohmann-json3/tests/src/unit-noexcept.cpp @@ -23,7 +23,7 @@ using nlohmann::json; namespace { -enum test {}; +enum test {}; // NOLINT(cppcoreguidelines-use-enum-class) struct pod {}; struct pod_bis {}; Index: nlohmann-json3/tests/src/unit-regression1.cpp =================================================================== --- nlohmann-json3.orig/tests/src/unit-regression1.cpp +++ nlohmann-json3/tests/src/unit-regression1.cpp @@ -177,7 +177,7 @@ TEST_CASE("regression tests 1") #ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION SECTION("pull request #71 - handle enum type") { - enum { t = 0, u = 102}; + enum { t = 0, u = 102}; // NOLINT(cppcoreguidelines-use-enum-class) json j = json::array(); j.push_back(t); Index: nlohmann-json3/tests/src/unit-regression2.cpp =================================================================== --- nlohmann-json3.orig/tests/src/unit-regression2.cpp +++ nlohmann-json3/tests/src/unit-regression2.cpp @@ -347,7 +347,7 @@ struct for_3204_foo struct for_3204_bar { - enum constructed_from_t + enum constructed_from_t // NOLINT(cppcoreguidelines-use-enum-class) { constructed_from_none = 0, constructed_from_foo = 1,