From 0083937dd5b79c696317d74e0fe94ebf94454ded Mon Sep 17 00:00:00 2001 From: Harinath Nampally Date: Mon, 20 Jan 2025 00:57:55 -0500 Subject: [PATCH] fix few more ci checks Signed-off-by: Harinath Nampally --- .../nlohmann_json_deserialize_enum_strict.cpp | 2 +- .../nlohmann_json_serialize_enum_strict.cpp | 2 +- tests/src/unit-conversions.cpp | 14 ++++---------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/docs/mkdocs/docs/examples/nlohmann_json_deserialize_enum_strict.cpp b/docs/mkdocs/docs/examples/nlohmann_json_deserialize_enum_strict.cpp index 62a6c4871..6675386d7 100644 --- a/docs/mkdocs/docs/examples/nlohmann_json_deserialize_enum_strict.cpp +++ b/docs/mkdocs/docs/examples/nlohmann_json_deserialize_enum_strict.cpp @@ -1,7 +1,7 @@ #include #include -#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) && !defined(JSON_THROW_USER) && !defined(JSON_THROW) #define JSON_THROW(exception) throw exception #else #include diff --git a/docs/mkdocs/docs/examples/nlohmann_json_serialize_enum_strict.cpp b/docs/mkdocs/docs/examples/nlohmann_json_serialize_enum_strict.cpp index d69a54818..723d7b86f 100644 --- a/docs/mkdocs/docs/examples/nlohmann_json_serialize_enum_strict.cpp +++ b/docs/mkdocs/docs/examples/nlohmann_json_serialize_enum_strict.cpp @@ -1,7 +1,7 @@ #include #include -#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) && !defined(JSON_THROW_USER) && !defined(JSON_THROW) #define JSON_THROW(exception) throw exception #else #include diff --git a/tests/src/unit-conversions.cpp b/tests/src/unit-conversions.cpp index bdf2315ef..40547e2dc 100644 --- a/tests/src/unit-conversions.cpp +++ b/tests/src/unit-conversions.cpp @@ -1657,16 +1657,7 @@ TEST_CASE("JSON to enum mapping") } } -#ifdef __cpp_exceptions - #undef __cpp_exceptions - #define __cpp_exceptions 1 -#endif - -#ifdef JSON_NOEXCEPTION - #define JSON_NOEXCEPTION 0 -#endif - -#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) +#if !defined(JSON_NOEXCEPTION) && !defined(JSON_THROW_USER) && !defined(JSON_THROW) #define JSON_THROW(exception) throw exception #else #include @@ -1738,6 +1729,9 @@ TEST_CASE("JSON to enum mapping") CHECK_THROWS_WITH_AS(j.template get(), "[json.exception.type_error.302] can't deserialize - invalid json value : \"foo\"", json::type_error); } } +#if defined(JSON_THROW) + #undef JSON_THROW +#endif #ifdef JSON_HAS_CPP_17 #ifndef JSON_USE_IMPLICIT_CONVERSIONS