From dbc96b93027c443b30e4afd6d5fa681c10030545 Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Wed, 9 Mar 2022 09:36:29 +0100 Subject: [PATCH] Don't undef some macros if JSON_TEST_KEEP_MACROS is defined --- include/nlohmann/detail/macro_unscope.hpp | 19 +++++++++++-------- single_include/nlohmann/json.hpp | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/include/nlohmann/detail/macro_unscope.hpp b/include/nlohmann/detail/macro_unscope.hpp index 1a29fb5e0..350d7b88e 100644 --- a/include/nlohmann/detail/macro_unscope.hpp +++ b/include/nlohmann/detail/macro_unscope.hpp @@ -8,19 +8,22 @@ // clean up #undef JSON_ASSERT #undef JSON_INTERNAL_CATCH -#undef JSON_CATCH #undef JSON_THROW -#undef JSON_TRY #undef JSON_PRIVATE_UNLESS_TESTED -#undef JSON_HAS_CPP_11 -#undef JSON_HAS_CPP_14 -#undef JSON_HAS_CPP_17 -#undef JSON_HAS_CPP_20 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION #undef NLOHMANN_BASIC_JSON_TPL #undef JSON_EXPLICIT #undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL +#ifndef JSON_TEST_KEEP_MACROS + #undef JSON_CATCH + #undef JSON_TRY + #undef JSON_HAS_CPP_11 + #undef JSON_HAS_CPP_14 + #undef JSON_HAS_CPP_17 + #undef JSON_HAS_CPP_20 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM +#endif + #include diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 05000fbba..d1135b27c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -21939,21 +21939,24 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std // clean up #undef JSON_ASSERT #undef JSON_INTERNAL_CATCH -#undef JSON_CATCH #undef JSON_THROW -#undef JSON_TRY #undef JSON_PRIVATE_UNLESS_TESTED -#undef JSON_HAS_CPP_11 -#undef JSON_HAS_CPP_14 -#undef JSON_HAS_CPP_17 -#undef JSON_HAS_CPP_20 -#undef JSON_HAS_FILESYSTEM -#undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION #undef NLOHMANN_BASIC_JSON_TPL #undef JSON_EXPLICIT #undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL +#ifndef JSON_TEST_KEEP_MACROS + #undef JSON_CATCH + #undef JSON_TRY + #undef JSON_HAS_CPP_11 + #undef JSON_HAS_CPP_14 + #undef JSON_HAS_CPP_17 + #undef JSON_HAS_CPP_20 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM +#endif + // #include