fix ci check

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
This commit is contained in:
Harinath Nampally 2025-01-26 18:33:04 -05:00
parent 11165ef68d
commit 0cda972377
3 changed files with 14 additions and 11 deletions

View File

@ -1,13 +1,6 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#if !defined(JSON_NOEXCEPTION) && !defined(JSON_THROW_USER) && !defined(JSON_THROW)
#define JSON_THROW(exception) throw exception
#else
#include <cstdlib>
#define JSON_THROW(exception) std::abort()
#endif
using json = nlohmann::json; using json = nlohmann::json;
namespace ns namespace ns

View File

@ -168,7 +168,6 @@
#define JSON_INTERNAL_CATCH(exception) catch(exception) #define JSON_INTERNAL_CATCH(exception) catch(exception)
#else #else
#include <cstdlib> #include <cstdlib>
std::forward<T>(exception);
#define JSON_THROW(exception) std::abort() #define JSON_THROW(exception) std::abort()
#define JSON_TRY if(true) #define JSON_TRY if(true)
#define JSON_CATCH(exception) if(false) #define JSON_CATCH(exception) if(false)
@ -249,7 +248,13 @@ namespace detail
template<typename T> template<typename T>
[[noreturn]] inline void json_throw_from_serialize_macro(T&& exception) [[noreturn]] inline void json_throw_from_serialize_macro(T&& exception)
{ {
JSON_THROW(std::forward<T>(exception)); #if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(EXCEPTIONS)
throw std::forward<T>(exception);
#else
// Forward the exception (even if unused) and abort
std::forward<T>(exception);
std::abort();
#endif
} }
} // namespace detail } // namespace detail
NLOHMANN_JSON_NAMESPACE_END NLOHMANN_JSON_NAMESPACE_END

View File

@ -2534,7 +2534,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP
#define JSON_INTERNAL_CATCH(exception) catch(exception) #define JSON_INTERNAL_CATCH(exception) catch(exception)
#else #else
#include <cstdlib> #include <cstdlib>
std::forward<T>(exception);
#define JSON_THROW(exception) std::abort() #define JSON_THROW(exception) std::abort()
#define JSON_TRY if(true) #define JSON_TRY if(true)
#define JSON_CATCH(exception) if(false) #define JSON_CATCH(exception) if(false)
@ -2615,7 +2614,13 @@ namespace detail
template<typename T> template<typename T>
[[noreturn]] inline void json_throw_from_serialize_macro(T&& exception) [[noreturn]] inline void json_throw_from_serialize_macro(T&& exception)
{ {
JSON_THROW(std::forward<T>(exception)); #if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(EXCEPTIONS)
throw std::forward<T>(exception);
#else
// Forward the exception (even if unused) and abort
std::forward<T>(exception);
std::abort();
#endif
} }
} // namespace detail } // namespace detail
NLOHMANN_JSON_NAMESPACE_END NLOHMANN_JSON_NAMESPACE_END