From 6d6381f596f081097d123b24a2091ae4c29bef39 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Fri, 18 Dec 2015 20:15:11 +0800 Subject: [PATCH] Try to fix clang and gcc warnings problems again x7 --- include/rapidjson/document.h | 4 ++-- include/rapidjson/rapidjson.h | 2 +- test/unittest/valuetest.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 3838af9..095aa40 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -1231,7 +1231,7 @@ public: for (MemberIterator itr = pos; itr != last; ++itr) itr->~Member(); std::memmove(&*pos, &*last, static_cast(MemberEnd() - last) * sizeof(Member)); - data_.o.size -= (last - first); + data_.o.size -= static_cast(last - first); return pos; } @@ -1431,7 +1431,7 @@ public: for (ValueIterator itr = pos; itr != last; ++itr) itr->~GenericValue(); std::memmove(pos, last, static_cast(End() - last) * sizeof(GenericValue)); - data_.a.size -= (last - first); + data_.a.size -= static_cast(last - first); return pos; } diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h index 41790cf..e3560b7 100644 --- a/include/rapidjson/rapidjson.h +++ b/include/rapidjson/rapidjson.h @@ -467,7 +467,7 @@ RAPIDJSON_NAMESPACE_END /////////////////////////////////////////////////////////////////////////////// // RAPIDJSON_NORETURN_SUFFIX -#if defined(__clang__) +#if defined(__clang__) && !defined(NDEBUG) #define RAPIDJSON_NORETURN_SUFFIX __attribute__ ((noreturn)) #else #define RAPIDJSON_NORETURN_SUFFIX diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp index 4e08e54..8d0f762 100644 --- a/test/unittest/valuetest.cpp +++ b/test/unittest/valuetest.cpp @@ -492,7 +492,7 @@ TEST(Value, Int64) { EXPECT_FALSE(z.IsUint()); EXPECT_NEAR(4294967296.0, z.GetDouble(), 0.0); - z.SetInt64(int64_t(-2147483648) - 1); // -2^31-1, cannot cast as int + z.SetInt64(-int64_t(2147483648u) - 1); // -2^31-1, cannot cast as int EXPECT_FALSE(z.IsInt()); EXPECT_NEAR(-2147483649.0, z.GetDouble(), 0.0);