Skip to content

Commit

Permalink
Allow overriding THROW/CATCH/TRY macros with no-exceptions #938
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaido committed Jan 28, 2018
1 parent cb4a9c8 commit 763ac32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions develop/detail/macro_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@
#define JSON_TRY try
#define JSON_CATCH(exception) catch(exception)
#else
#if !defined(JSON_THROW)
#define JSON_THROW(exception) std::abort()
#endif
#if !defined(JSON_TRY)
#define JSON_TRY if(true)
#endif
#if !defined(JSON_CATCH)
#define JSON_CATCH(exception) if(false)
#endif
#endif

// manual branch prediction
Expand Down
6 changes: 6 additions & 0 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,15 @@ using json = basic_json<>;
#define JSON_TRY try
#define JSON_CATCH(exception) catch(exception)
#else
#if !defined(JSON_THROW)
#define JSON_THROW(exception) std::abort()
#endif
#if !defined(JSON_TRY)
#define JSON_TRY if(true)
#endif
#if !defined(JSON_CATCH)
#define JSON_CATCH(exception) if(false)
#endif
#endif

// manual branch prediction
Expand Down

0 comments on commit 763ac32

Please sign in to comment.