Permalink
Browse files

Merge pull request #1329 from pah/fix-noexcept

Add RAPIDJSON_NOEXCEPT_ASSERT
  • Loading branch information...
miloyip committed Sep 11, 2018
2 parents c2aa79d + 783b819 commit c0ca05f6ddb690c943a7fc59efab9ca9cfc39736
Showing with 13 additions and 5 deletions.
  1. +2 −5 include/rapidjson/document.h
  2. +11 −0 include/rapidjson/rapidjson.h
@@ -37,9 +37,6 @@ RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible lo
#ifdef __GNUC__
RAPIDJSON_DIAG_OFF(effc++)
#if __GNUC__ >= 6
RAPIDJSON_DIAG_OFF(terminate) // ignore throwing RAPIDJSON_ASSERT in RAPIDJSON_NOEXCEPT functions
#endif
#endif // __GNUC__
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
@@ -625,7 +622,7 @@ class GenericValue {
\note Default content for number is zero.
*/
explicit GenericValue(Type type) RAPIDJSON_NOEXCEPT : data_() {
static const uint16_t defaultFlags[7] = {
static const uint16_t defaultFlags[] = {
kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag,
kNumberAnyFlag
};
@@ -831,7 +828,7 @@ class GenericValue {
/*! \param rhs Source of the assignment. It will become a null value after assignment.
*/
GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
if (this != &rhs) {
if (RAPIDJSON_LIKELY(this != &rhs)) {
this->~GenericValue();
RawAssign(rhs);
}
@@ -593,6 +593,17 @@ RAPIDJSON_NAMESPACE_END
//!@endcond
//! Assertion (in non-throwing contexts).
/*! \ingroup RAPIDJSON_CONFIG
Some functions provide a \c noexcept guarantee, if the compiler supports it.
In these cases, the \ref RAPIDJSON_ASSERT macro cannot be overridden to
throw an exception. This macro adds a separate customization point for
such cases.
Defaults to C \c assert() (as \ref RAPIDJSON_ASSERT), if \c noexcept is
supported, and to \ref RAPIDJSON_ASSERT otherwise.
*/
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NOEXCEPT_ASSERT

0 comments on commit c0ca05f

Please sign in to comment.