forked from mirrors/gecko-dev
MozReview-Commit-ID: 2g9sFP6QQCU --HG-- rename : toolkit/crashreporter/jsoncpp/AUTHORS => toolkit/components/jsoncpp/AUTHORS rename : toolkit/crashreporter/jsoncpp/GIT-INFO => toolkit/components/jsoncpp/GIT-INFO rename : toolkit/crashreporter/jsoncpp/LICENSE => toolkit/components/jsoncpp/LICENSE rename : toolkit/crashreporter/jsoncpp/NEWS.txt => toolkit/components/jsoncpp/NEWS.txt rename : toolkit/crashreporter/jsoncpp/README.md => toolkit/components/jsoncpp/README.md rename : toolkit/crashreporter/jsoncpp/include/json/allocator.h => toolkit/components/jsoncpp/include/json/allocator.h rename : toolkit/crashreporter/jsoncpp/include/json/assertions.h => toolkit/components/jsoncpp/include/json/assertions.h rename : toolkit/crashreporter/jsoncpp/include/json/autolink.h => toolkit/components/jsoncpp/include/json/autolink.h rename : toolkit/crashreporter/jsoncpp/include/json/config.h => toolkit/components/jsoncpp/include/json/config.h rename : toolkit/crashreporter/jsoncpp/include/json/features.h => toolkit/components/jsoncpp/include/json/features.h rename : toolkit/crashreporter/jsoncpp/include/json/forwards.h => toolkit/components/jsoncpp/include/json/forwards.h rename : toolkit/crashreporter/jsoncpp/include/json/json.h => toolkit/components/jsoncpp/include/json/json.h rename : toolkit/crashreporter/jsoncpp/include/json/reader.h => toolkit/components/jsoncpp/include/json/reader.h rename : toolkit/crashreporter/jsoncpp/include/json/value.h => toolkit/components/jsoncpp/include/json/value.h rename : toolkit/crashreporter/jsoncpp/include/json/version.h => toolkit/components/jsoncpp/include/json/version.h rename : toolkit/crashreporter/jsoncpp/include/json/writer.h => toolkit/components/jsoncpp/include/json/writer.h rename : toolkit/crashreporter/jsoncpp/src/lib_json/json_reader.cpp => toolkit/components/jsoncpp/src/lib_json/json_reader.cpp rename : toolkit/crashreporter/jsoncpp/src/lib_json/json_tool.h => toolkit/components/jsoncpp/src/lib_json/json_tool.h rename : toolkit/crashreporter/jsoncpp/src/lib_json/json_value.cpp => toolkit/components/jsoncpp/src/lib_json/json_value.cpp rename : toolkit/crashreporter/jsoncpp/src/lib_json/json_valueiterator.inl => toolkit/components/jsoncpp/src/lib_json/json_valueiterator.inl rename : toolkit/crashreporter/jsoncpp/src/lib_json/json_writer.cpp => toolkit/components/jsoncpp/src/lib_json/json_writer.cpp extra : rebase_source : 6996fe5fd4a8e704a138b568d636c1d5238f15b2
54 lines
2.2 KiB
C
54 lines
2.2 KiB
C
// Copyright 2007-2010 Baptiste Lepilleur
|
|
// Distributed under MIT license, or public domain if desired and
|
|
// recognized in your jurisdiction.
|
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
|
|
#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
|
#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
|
|
|
#include <stdlib.h>
|
|
#include <sstream>
|
|
|
|
#if !defined(JSON_IS_AMALGAMATION)
|
|
#include "config.h"
|
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
|
|
|
/** It should not be possible for a maliciously designed file to
|
|
* cause an abort() or seg-fault, so these macros are used only
|
|
* for pre-condition violations and internal logic errors.
|
|
*/
|
|
#if JSON_USE_EXCEPTION
|
|
|
|
// @todo <= add detail about condition in exception
|
|
# define JSON_ASSERT(condition) \
|
|
{if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
|
|
|
|
# define JSON_FAIL_MESSAGE(message) \
|
|
{ \
|
|
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
|
Json::throwLogicError(oss.str()); \
|
|
abort(); \
|
|
}
|
|
|
|
#else // JSON_USE_EXCEPTION
|
|
|
|
# define JSON_ASSERT(condition) assert(condition)
|
|
|
|
// The call to assert() will show the failure message in debug builds. In
|
|
// release builds we abort, for a core-dump or debugger.
|
|
# define JSON_FAIL_MESSAGE(message) \
|
|
{ \
|
|
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
|
assert(false && oss.str().c_str()); \
|
|
abort(); \
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
#define JSON_ASSERT_MESSAGE(condition, message) \
|
|
if (!(condition)) { \
|
|
JSON_FAIL_MESSAGE(message); \
|
|
}
|
|
|
|
#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
|