Skip to content

Commit 0cda972

Browse files
committed
fix ci check
Signed-off-by: Harinath Nampally <[email protected]>
1 parent 11165ef commit 0cda972

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

docs/mkdocs/docs/examples/nlohmann_json_deserialize_enum_strict.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
#include <iostream>
22
#include <nlohmann/json.hpp>
33

4-
#if !defined(JSON_NOEXCEPTION) && !defined(JSON_THROW_USER) && !defined(JSON_THROW)
5-
#define JSON_THROW(exception) throw exception
6-
#else
7-
#include <cstdlib>
8-
#define JSON_THROW(exception) std::abort()
9-
#endif
10-
114
using json = nlohmann::json;
125

136
namespace ns

include/nlohmann/detail/macro_scope.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
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)
@@ -249,7 +248,13 @@ namespace detail
249248
template<typename T>
250249
[[noreturn]] inline void json_throw_from_serialize_macro(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
255260
NLOHMANN_JSON_NAMESPACE_END

single_include/nlohmann/json.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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)
@@ -2615,7 +2614,13 @@ namespace detail
26152614
template<typename T>
26162615
[[noreturn]] inline void json_throw_from_serialize_macro(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
26212626
NLOHMANN_JSON_NAMESPACE_END

0 commit comments

Comments
 (0)