diff options
author | Patrick Cheng <patrickyccheng@gmail.com> | 2016-09-30 20:47:00 +0300 |
---|---|---|
committer | Patrick Cheng <patrickyccheng@gmail.com> | 2016-09-30 20:47:00 +0300 |
commit | 9d8df28c1dd92be8480fae8026fed0aa2c0d8cdd (patch) | |
tree | b60e25514b7562a110daab9f93fc01a1db9605da /include/rapidjson/internal | |
parent | ffc79428577d453ebf083a0eeba56dbc33f67089 (diff) |
added assertion to help suppress clang warnings
Diffstat (limited to 'include/rapidjson/internal')
-rw-r--r-- | include/rapidjson/internal/stack.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/rapidjson/internal/stack.h b/include/rapidjson/internal/stack.h index 022c9aab..54ac77a8 100644 --- a/include/rapidjson/internal/stack.h +++ b/include/rapidjson/internal/stack.h @@ -113,6 +113,7 @@ public: // Expansion is run very infrequently, so it is moved to another (probably non-inline) function. template<typename T> RAPIDJSON_FORCEINLINE void Reserve(size_t count = 1) { + RAPIDJSON_ASSERT(stackTop_); // Expand the stack if needed if (RAPIDJSON_UNLIKELY(stackTop_ + sizeof(T) * count > stackEnd_)) Expand<T>(count); @@ -126,6 +127,7 @@ public: template<typename T> RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) { + RAPIDJSON_ASSERT(stackTop_); RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_); T* ret = reinterpret_cast<T*>(stackTop_); stackTop_ += sizeof(T) * count; |