| 1 |
commit 30d27df61c7758a948559cebfe5e3e6c9e1803b6 |
| 2 |
Author: Niels Lohmann <[email protected]> |
| 3 |
Date: Thu Jul 31 20:10:57 2025 +0200 |
| 4 |
|
| 5 |
Fix CI (#4871) |
| 6 |
|
| 7 |
* :construction_worker: fix CI |
| 8 |
|
| 9 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 10 |
|
| 11 |
* :construction_worker: fix CI |
| 12 |
|
| 13 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 14 |
|
| 15 |
* :construction_worker: fix CI |
| 16 |
|
| 17 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 18 |
|
| 19 |
* :construction_worker: fix CI |
| 20 |
|
| 21 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 22 |
|
| 23 |
* :construction_worker: fix CI |
| 24 |
|
| 25 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 26 |
|
| 27 |
* :construction_worker: fix CI |
| 28 |
|
| 29 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 30 |
|
| 31 |
* :construction_worker: fix CI |
| 32 |
|
| 33 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 34 |
|
| 35 |
* :construction_worker: fix CI |
| 36 |
|
| 37 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 38 |
|
| 39 |
* :construction_worker: fix CI |
| 40 |
|
| 41 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 42 |
|
| 43 |
* :construction_worker: fix CI |
| 44 |
|
| 45 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 46 |
|
| 47 |
* :construction_worker: fix CI |
| 48 |
|
| 49 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 50 |
|
| 51 |
* :construction_worker: fix CI |
| 52 |
|
| 53 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 54 |
|
| 55 |
* :construction_worker: fix CI |
| 56 |
|
| 57 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 58 |
|
| 59 |
* :construction_worker: fix CI |
| 60 |
|
| 61 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 62 |
|
| 63 |
* :construction_worker: fix CI |
| 64 |
|
| 65 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 66 |
|
| 67 |
--------- |
| 68 |
|
| 69 |
Signed-off-by: Niels Lohmann <[email protected]> |
| 70 |
|
| 71 |
Index: nlohmann-json3/cmake/clang_flags.cmake |
| 72 |
=================================================================== |
| 73 |
--- nlohmann-json3.orig/cmake/clang_flags.cmake |
| 74 |
+++ nlohmann-json3/cmake/clang_flags.cmake |
| 75 |
@@ -6,6 +6,7 @@ |
| 76 |
# -Wno-padded We do not care about padding warnings. |
| 77 |
# -Wno-covered-switch-default All switches list all cases and a default case. |
| 78 |
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile. |
| 79 |
+# -Wno-missing-noreturn We found no way to silence this warning otherwise, see PR #4871 |
| 80 |
|
| 81 |
set(CLANG_CXXFLAGS |
| 82 |
-Werror |
| 83 |
@@ -17,4 +18,5 @@ set(CLANG_CXXFLAGS |
| 84 |
-Wno-padded |
| 85 |
-Wno-covered-switch-default |
| 86 |
-Wno-unsafe-buffer-usage |
| 87 |
+ -Wno-missing-noreturn |
| 88 |
) |
| 89 |
Index: nlohmann-json3/cmake/download_test_data.cmake |
| 90 |
=================================================================== |
| 91 |
--- nlohmann-json3.orig/cmake/download_test_data.cmake |
| 92 |
+++ nlohmann-json3/cmake/download_test_data.cmake |
| 93 |
@@ -1,21 +1,33 @@ |
| 94 |
set(JSON_TEST_DATA_URL https://github.com/nlohmann/json_test_data) |
| 95 |
set(JSON_TEST_DATA_VERSION 3.1.0) |
| 96 |
|
| 97 |
+include(ExternalProject) |
| 98 |
+ |
| 99 |
# if variable is set, use test data from given directory rather than downloading them |
| 100 |
if(JSON_TestDataDirectory) |
| 101 |
message(STATUS "Using test data in ${JSON_TestDataDirectory}.") |
| 102 |
add_custom_target(download_test_data) |
| 103 |
file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${JSON_TestDataDirectory}\"\n") |
| 104 |
else() |
| 105 |
- find_package(Git) |
| 106 |
+ # create a header with the path to the downloaded test data |
| 107 |
+ file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/test_files\"\n") |
| 108 |
+ |
| 109 |
+ # download test data from GitHub release |
| 110 |
+ ExternalProject_Add(download_test_data_project |
| 111 |
+ URL "${JSON_TEST_DATA_URL}/archive/refs/tags/v${JSON_TEST_DATA_VERSION}.zip" |
| 112 |
+ SOURCE_DIR "${CMAKE_BINARY_DIR}/test_files" |
| 113 |
+ CONFIGURE_COMMAND "" |
| 114 |
+ BUILD_COMMAND "" |
| 115 |
+ INSTALL_COMMAND "" |
| 116 |
+ LOG_DOWNLOAD TRUE |
| 117 |
+ DOWNLOAD_EXTRACT_TIMESTAMP TRUE |
| 118 |
+ EXCLUDE_FROM_ALL TRUE |
| 119 |
+ ) |
| 120 |
+ |
| 121 |
# target to download test data |
| 122 |
add_custom_target(download_test_data |
| 123 |
- 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 |
| 124 |
- COMMENT "Downloading test data from ${JSON_TEST_DATA_URL} (v${JSON_TEST_DATA_VERSION})" |
| 125 |
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
| 126 |
+ DEPENDS download_test_data_project |
| 127 |
) |
| 128 |
- # create a header with the path to the downloaded test data |
| 129 |
- file(WRITE ${CMAKE_BINARY_DIR}/include/test_data.hpp "#define TEST_DATA_DIRECTORY \"${CMAKE_BINARY_DIR}/json_test_data\"\n") |
| 130 |
endif() |
| 131 |
|
| 132 |
# determine the operating system (for debug and support purposes) |
| 133 |
Index: nlohmann-json3/include/nlohmann/detail/input/input_adapters.hpp |
| 134 |
=================================================================== |
| 135 |
--- nlohmann-json3.orig/include/nlohmann/detail/input/input_adapters.hpp |
| 136 |
+++ nlohmann-json3/include/nlohmann/detail/input/input_adapters.hpp |
| 137 |
@@ -401,7 +401,7 @@ template<typename T> |
| 138 |
struct is_iterator_of_multibyte |
| 139 |
{ |
| 140 |
using value_type = typename std::iterator_traits<T>::value_type; |
| 141 |
- enum |
| 142 |
+ enum // NOLINT(cppcoreguidelines-use-enum-class) |
| 143 |
{ |
| 144 |
value = sizeof(value_type) > 1 |
| 145 |
}; |
| 146 |
Index: nlohmann-json3/include/nlohmann/detail/meta/type_traits.hpp |
| 147 |
=================================================================== |
| 148 |
--- nlohmann-json3.orig/include/nlohmann/detail/meta/type_traits.hpp |
| 149 |
+++ nlohmann-json3/include/nlohmann/detail/meta/type_traits.hpp |
| 150 |
@@ -655,7 +655,7 @@ struct is_ordered_map |
| 151 |
template <typename C> static one test( decltype(&C::capacity) ) ; |
| 152 |
template <typename C> static two test(...); |
| 153 |
|
| 154 |
- enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) |
| 155 |
+ enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class) |
| 156 |
}; |
| 157 |
|
| 158 |
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) |
| 159 |
Index: nlohmann-json3/single_include/nlohmann/json.hpp |
| 160 |
=================================================================== |
| 161 |
--- nlohmann-json3.orig/single_include/nlohmann/json.hpp |
| 162 |
+++ nlohmann-json3/single_include/nlohmann/json.hpp |
| 163 |
@@ -4192,7 +4192,7 @@ struct is_ordered_map |
| 164 |
template <typename C> static one test( decltype(&C::capacity) ) ; |
| 165 |
template <typename C> static two test(...); |
| 166 |
|
| 167 |
- enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) |
| 168 |
+ enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg,cppcoreguidelines-use-enum-class) |
| 169 |
}; |
| 170 |
|
| 171 |
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) |
| 172 |
@@ -6888,7 +6888,7 @@ template<typename T> |
| 173 |
struct is_iterator_of_multibyte |
| 174 |
{ |
| 175 |
using value_type = typename std::iterator_traits<T>::value_type; |
| 176 |
- enum |
| 177 |
+ enum // NOLINT(cppcoreguidelines-use-enum-class) |
| 178 |
{ |
| 179 |
value = sizeof(value_type) > 1 |
| 180 |
}; |
| 181 |
Index: nlohmann-json3/tests/src/unit-conversions.cpp |
| 182 |
=================================================================== |
| 183 |
--- nlohmann-json3.orig/tests/src/unit-conversions.cpp |
| 184 |
+++ nlohmann-json3/tests/src/unit-conversions.cpp |
| 185 |
@@ -1352,7 +1352,7 @@ TEST_CASE("value conversion") |
| 186 |
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION |
| 187 |
SECTION("get an enum") |
| 188 |
{ |
| 189 |
- enum c_enum { value_1, value_2 }; |
| 190 |
+ enum c_enum { value_1, value_2 }; // NOLINT(cppcoreguidelines-use-enum-class) |
| 191 |
enum class cpp_enum { value_1, value_2 }; |
| 192 |
|
| 193 |
CHECK(json(value_1).get<c_enum>() == value_1); |
| 194 |
@@ -1601,7 +1601,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(cards, |
| 195 |
{cards::karo, "karo"} |
| 196 |
}) |
| 197 |
|
| 198 |
-enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value) |
| 199 |
+enum TaskState // NOLINT(cert-int09-c,readability-enum-initial-value,cppcoreguidelines-use-enum-class) |
| 200 |
{ |
| 201 |
TS_STOPPED, |
| 202 |
TS_RUNNING, |
| 203 |
Index: nlohmann-json3/tests/src/unit-noexcept.cpp |
| 204 |
=================================================================== |
| 205 |
--- nlohmann-json3.orig/tests/src/unit-noexcept.cpp |
| 206 |
+++ nlohmann-json3/tests/src/unit-noexcept.cpp |
| 207 |
@@ -23,7 +23,7 @@ using nlohmann::json; |
| 208 |
|
| 209 |
namespace |
| 210 |
{ |
| 211 |
-enum test {}; |
| 212 |
+enum test {}; // NOLINT(cppcoreguidelines-use-enum-class) |
| 213 |
|
| 214 |
struct pod {}; |
| 215 |
struct pod_bis {}; |
| 216 |
Index: nlohmann-json3/tests/src/unit-regression1.cpp |
| 217 |
=================================================================== |
| 218 |
--- nlohmann-json3.orig/tests/src/unit-regression1.cpp |
| 219 |
+++ nlohmann-json3/tests/src/unit-regression1.cpp |
| 220 |
@@ -177,7 +177,7 @@ TEST_CASE("regression tests 1") |
| 221 |
#ifndef SKIP_TESTS_FOR_ENUM_SERIALIZATION |
| 222 |
SECTION("pull request #71 - handle enum type") |
| 223 |
{ |
| 224 |
- enum { t = 0, u = 102}; |
| 225 |
+ enum { t = 0, u = 102}; // NOLINT(cppcoreguidelines-use-enum-class) |
| 226 |
json j = json::array(); |
| 227 |
j.push_back(t); |
| 228 |
|
| 229 |
Index: nlohmann-json3/tests/src/unit-regression2.cpp |
| 230 |
=================================================================== |
| 231 |
--- nlohmann-json3.orig/tests/src/unit-regression2.cpp |
| 232 |
+++ nlohmann-json3/tests/src/unit-regression2.cpp |
| 233 |
@@ -347,7 +347,7 @@ struct for_3204_foo |
| 234 |
|
| 235 |
struct for_3204_bar |
| 236 |
{ |
| 237 |
- enum constructed_from_t |
| 238 |
+ enum constructed_from_t // NOLINT(cppcoreguidelines-use-enum-class) |
| 239 |
{ |
| 240 |
constructed_from_none = 0, |
| 241 |
constructed_from_foo = 1, |