Skip to content

Commit

Permalink
Made JSON_USE_EXCEPTION's value in config.h a default that can be ove…
Browse files Browse the repository at this point in the history
…rridden.

This allows users to override it with their compiler invocation. For example:

    g++ -D JSON_USE_EXCEPTION=0 ...



git-svn-id: https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk@246 1f120ed1-78a5-a849-adca-83f0a9e25bb6
  • Loading branch information
aaronjacobs authored and rjeczalik committed Dec 17, 2012
1 parent b0b7260 commit e3d1414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions include/json/config.h
Expand Up @@ -24,9 +24,11 @@
/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1

/// If defined, indicates that Json use exception to report invalid type manipulation
/// instead of C assert macro.
// If non-zero, the library uses exceptions to report bad input instead of C
// assertion macros. The default is to use exceptions.
# ifndef JSON_USE_EXCEPTION
# define JSON_USE_EXCEPTION 1
# endif

/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
Expand Down
4 changes: 2 additions & 2 deletions jsoncpp/include/json/assertions.h
Expand Up @@ -13,10 +13,10 @@
# include <json/config.h>
#endif // if !defined(JSON_IS_AMALGAMATION)

#if defined(JSON_USE_EXCEPTION)
#if JSON_USE_EXCEPTION
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
#else // defined(JSON_USE_EXCEPTION)
#else // JSON_USE_EXCEPTION
#define JSON_ASSERT( condition ) assert( condition );
#define JSON_FAIL_MESSAGE( message ) { std::cerr << std::endl << message << std::endl; exit(123); }
#endif
Expand Down

0 comments on commit e3d1414

Please sign in to comment.