Skip to content

Commit

Permalink
fix ci check
Browse files Browse the repository at this point in the history
Signed-off-by: Harinath Nampally <[email protected]>
  • Loading branch information
hnampally committed Jan 27, 2025
1 parent 11165ef commit 0cda972
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#include <iostream>
#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;

namespace ns
Expand Down
9 changes: 7 additions & 2 deletions include/nlohmann/detail/macro_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
#define JSON_INTERNAL_CATCH(exception) catch(exception)
#else
#include <cstdlib>
std::forward<T>(exception);
#define JSON_THROW(exception) std::abort()
#define JSON_TRY if(true)
#define JSON_CATCH(exception) if(false)
Expand Down Expand Up @@ -249,7 +248,13 @@ namespace detail
template<typename T>
[[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
NLOHMANN_JSON_NAMESPACE_END
Expand Down
9 changes: 7 additions & 2 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP
#define JSON_INTERNAL_CATCH(exception) catch(exception)
#else
#include <cstdlib>
std::forward<T>(exception);
#define JSON_THROW(exception) std::abort()
#define JSON_TRY if(true)
#define JSON_CATCH(exception) if(false)
Expand Down Expand Up @@ -2615,7 +2614,13 @@ namespace detail
template<typename T>
[[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
NLOHMANN_JSON_NAMESPACE_END
Expand Down

0 comments on commit 0cda972

Please sign in to comment.