Try to fix clang and gcc warnings problems again x3

This commit is contained in:
Milo Yip 2015-12-18 19:47:11 +08:00
parent a6a73b51b5
commit 4cb7c88ca9
2 changed files with 11 additions and 2 deletions

View File

@ -164,12 +164,12 @@ TEST(Reader, ParseNumber_Integer) {
u.u |= r(); u.u |= r();
char buffer[32]; char buffer[32];
if (u.u > 4294967295) { if (u.u > uint64_t(4294967295u)) {
*internal::u64toa(u.u, buffer) = '\0'; *internal::u64toa(u.u, buffer) = '\0';
TEST_INTEGER(ParseUint64Handler, buffer, u.u); TEST_INTEGER(ParseUint64Handler, buffer, u.u);
} }
if (u.i < -2147483648) { if (u.i < -int64_t(2147483648u)) {
*internal::i64toa(u.i, buffer) = '\0'; *internal::i64toa(u.i, buffer) = '\0';
TEST_INTEGER(ParseInt64Handler, buffer, u.i); TEST_INTEGER(ParseInt64Handler, buffer, u.i);
} }

View File

@ -16,6 +16,11 @@
#include "rapidjson/internal/strtod.h" #include "rapidjson/internal/strtod.h"
#ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(unreachable-code)
#endif
#define BIGINTEGER_LITERAL(s) BigInteger(s, sizeof(s) - 1) #define BIGINTEGER_LITERAL(s) BigInteger(s, sizeof(s) - 1)
using namespace rapidjson::internal; using namespace rapidjson::internal;
@ -121,3 +126,7 @@ TEST(Strtod, CheckApproximationCase) {
EXPECT_EQ(-1, delta.Compare(hS)); EXPECT_EQ(-1, delta.Compare(hS));
} }
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif