File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 168168 #define JSON_INTERNAL_CATCH (exception ) catch (exception)
169169#else
170170 #include < cstdlib>
171- std::forward<T>(exception);
172171 #define JSON_THROW (exception ) std::abort()
173172 #define JSON_TRY if (true )
174173 #define JSON_CATCH (exception ) if (false )
@@ -247,9 +246,15 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
247246namespace detail
248247{
249248template <typename T>
250- [[noreturn]] inline void json_throw_from_serialize_macro (T&& exception)
249+ [[noreturn]] inline void throw_if_exceptions_enabled (T&& exception)
251250{
252- JSON_THROW (std::forward<T>(exception));
251+ #if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(EXCEPTIONS)
252+ throw std::forward<T>(exception);
253+ #else
254+ // Forward the exception (even if unused) and abort
255+ std::forward<T>(exception);
256+ std::abort ();
257+ #endif
253258}
254259} // namespace detail
255260NLOHMANN_JSON_NAMESPACE_END
Original file line number Diff line number Diff line change @@ -2534,7 +2534,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP
25342534 #define JSON_INTERNAL_CATCH(exception) catch(exception)
25352535#else
25362536 #include <cstdlib>
2537- std::forward<T>(exception);
25382537 #define JSON_THROW(exception) std::abort()
25392538 #define JSON_TRY if(true)
25402539 #define JSON_CATCH(exception) if(false)
@@ -2613,9 +2612,15 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
26132612namespace detail
26142613{
26152614template<typename T>
2616- [[noreturn]] inline void json_throw_from_serialize_macro (T&& exception)
2615+ [[noreturn]] inline void throw_if_exceptions_enabled (T&& exception)
26172616{
2618- JSON_THROW(std::forward<T>(exception));
2617+ #if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(EXCEPTIONS)
2618+ throw std::forward<T>(exception);
2619+ #else
2620+ // Forward the exception (even if unused) and abort
2621+ std::forward<T>(exception);
2622+ std::abort();
2623+ #endif
26192624}
26202625} // namespace detail
26212626NLOHMANN_JSON_NAMESPACE_END
You can’t perform that action at this time.
0 commit comments