Skip to content

Commit 11165ef

Browse files
committed
address review comments
Signed-off-by: Harinath Nampally <[email protected]>
1 parent 2898659 commit 11165ef

File tree

4 files changed

+3
-38
lines changed

4 files changed

+3
-38
lines changed

docs/mkdocs/docs/examples/nlohmann_json_serialize_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

docs/mkdocs/docs/features/enum_conversion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Other Important points:
6060
map will be returned when converting to or from JSON.
6161
- To disable the default serialization of enumerators as integers and force a compiler error instead, see [`JSON_DISABLE_ENUM_SERIALIZATION`](../api/macros/json_disable_enum_serialization.md).
6262

63-
An alternative macro [`NLOHMANN_JSON_SERIALIZE_ENUM_STRICT()` macro](../api/macros/nlohmann_json_serialize_enum.md) can be used when a more strict error handling is preffered, throwing in case of serialization errors instead of defaulting to the first enum value defined in the macro.
63+
An alternative macro [`NLOHMANN_JSON_SERIALIZE_ENUM_STRICT()` macro](../api/macros/nlohmann_json_serialize_enum.md) can be used when a more strict error handling is preferred, throwing in case of serialization errors instead of defaulting to the first enum value defined in the macro.
6464

6565
## Usage
6666
```cpp

include/nlohmann/detail/macro_scope.hpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717

1818
#include <nlohmann/detail/abi_macros.hpp>
1919

20-
21-
// exclude unsupported compilers
22-
#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
23-
#if defined(__clang__)
24-
#if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
25-
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
26-
#endif
27-
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
28-
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
29-
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
30-
#endif
31-
#endif
32-
#endif
33-
3420
// exclude unsupported compilers
3521
#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
3622
#if defined(__clang__)
@@ -182,6 +168,7 @@
182168
#define JSON_INTERNAL_CATCH(exception) catch(exception)
183169
#else
184170
#include <cstdlib>
171+
std::forward<T>(exception);
185172
#define JSON_THROW(exception) std::abort()
186173
#define JSON_TRY if(true)
187174
#define JSON_CATCH(exception) if(false)
@@ -262,7 +249,6 @@ namespace detail
262249
template<typename T>
263250
[[noreturn]] inline void json_throw_from_serialize_macro(T&& exception)
264251
{
265-
static_cast<void>(exception);
266252
JSON_THROW(std::forward<T>(exception));
267253
}
268254
} // namespace detail

single_include/nlohmann/json.hpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,20 +2383,6 @@ JSON_HEDLEY_DIAGNOSTIC_POP
23832383
// #include <nlohmann/detail/abi_macros.hpp>
23842384

23852385

2386-
2387-
// exclude unsupported compilers
2388-
#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
2389-
#if defined(__clang__)
2390-
#if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
2391-
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
2392-
#endif
2393-
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
2394-
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
2395-
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
2396-
#endif
2397-
#endif
2398-
#endif
2399-
24002386
// exclude unsupported compilers
24012387
#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
24022388
#if defined(__clang__)
@@ -2548,6 +2534,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
25482534
#define JSON_INTERNAL_CATCH(exception) catch(exception)
25492535
#else
25502536
#include <cstdlib>
2537+
std::forward<T>(exception);
25512538
#define JSON_THROW(exception) std::abort()
25522539
#define JSON_TRY if(true)
25532540
#define JSON_CATCH(exception) if(false)
@@ -2628,7 +2615,6 @@ namespace detail
26282615
template<typename T>
26292616
[[noreturn]] inline void json_throw_from_serialize_macro(T&& exception)
26302617
{
2631-
static_cast<void>(exception);
26322618
JSON_THROW(std::forward<T>(exception));
26332619
}
26342620
} // namespace detail

0 commit comments

Comments
 (0)