Skip to content

Commit 9d8df28

Browse files
committed
added assertion to help suppress clang warnings
1 parent ffc7942 commit 9d8df28

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/rapidjson/internal/stack.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class Stack {
113113
// Expansion is run very infrequently, so it is moved to another (probably non-inline) function.
114114
template<typename T>
115115
RAPIDJSON_FORCEINLINE void Reserve(size_t count = 1) {
116+
RAPIDJSON_ASSERT(stackTop_);
116117
// Expand the stack if needed
117118
if (RAPIDJSON_UNLIKELY(stackTop_ + sizeof(T) * count > stackEnd_))
118119
Expand<T>(count);
@@ -126,6 +127,7 @@ class Stack {
126127

127128
template<typename T>
128129
RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) {
130+
RAPIDJSON_ASSERT(stackTop_);
129131
RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_);
130132
T* ret = reinterpret_cast<T*>(stackTop_);
131133
stackTop_ += sizeof(T) * count;

0 commit comments

Comments
 (0)