Merge pull request #757 from patcheng/feature/fix_clang_warning

added assertion to help suppress clang warnings
This commit is contained in:
Milo Yip 2016-12-23 10:00:30 +08:00 committed by GitHub
commit 03a7391049
2 changed files with 7 additions and 4 deletions

View File

@ -126,6 +126,7 @@ public:
template<typename T> template<typename T>
RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) { RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) {
RAPIDJSON_ASSERT(stackTop_);
RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_); RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_);
T* ret = reinterpret_cast<T*>(stackTop_); T* ret = reinterpret_cast<T*>(stackTop_);
stackTop_ += sizeof(T) * count; stackTop_ += sizeof(T) * count;

View File

@ -934,11 +934,13 @@ private:
#else #else
length = static_cast<SizeType>(__builtin_ffs(r) - 1); length = static_cast<SizeType>(__builtin_ffs(r) - 1);
#endif #endif
char* q = reinterpret_cast<char*>(os.Push(length)); if (length != 0) {
for (size_t i = 0; i < length; i++) char* q = reinterpret_cast<char*>(os.Push(length));
q[i] = p[i]; for (size_t i = 0; i < length; i++)
q[i] = p[i];
p += length; p += length;
}
break; break;
} }
_mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s); _mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s);