Commit 6da92274 authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge pull request #667 from pah/fixes/666

Fix warnings on GCC 6 and later (closes #666)
parents cf7324b4 f6a07692
...@@ -25,23 +25,24 @@ ...@@ -25,23 +25,24 @@
#include <new> // placement new #include <new> // placement new
#include <limits> #include <limits>
#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PUSH
#ifdef _MSC_VER
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data
#endif #endif
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(padded) RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(switch-enum) RAPIDJSON_DIAG_OFF(switch-enum)
RAPIDJSON_DIAG_OFF(c++98-compat) RAPIDJSON_DIAG_OFF(c++98-compat)
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++) RAPIDJSON_DIAG_OFF(effc++)
#if __GNUC__ >= 6
RAPIDJSON_DIAG_OFF(terminate) // ignore throwing RAPIDJSON_ASSERT in RAPIDJSON_NOEXCEPT functions
#endif #endif
#endif // __GNUC__
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS #ifndef RAPIDJSON_NOMEMBERITERATORCLASS
#include <iterator> // std::iterator, std::random_access_iterator_tag #include <iterator> // std::iterator, std::random_access_iterator_tag
...@@ -2569,17 +2570,6 @@ private: ...@@ -2569,17 +2570,6 @@ private:
}; };
RAPIDJSON_NAMESPACE_END RAPIDJSON_NAMESPACE_END
#ifdef _MSC_VER
RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_POP
#endif
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_DOCUMENT_H_ #endif // RAPIDJSON_DOCUMENT_H_
...@@ -19,13 +19,6 @@ ...@@ -19,13 +19,6 @@
#include "pointer.h" #include "pointer.h"
#include <cmath> // abs, floor #include <cmath> // abs, floor
#ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(weak-vtables)
RAPIDJSON_DIAG_OFF(exit-time-destructors)
RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
#endif
#if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX) #if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX)
#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1 #define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1
#else #else
...@@ -58,18 +51,20 @@ RAPIDJSON_DIAG_OFF(c++98-compat-pedantic) ...@@ -58,18 +51,20 @@ RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
#include "stringbuffer.h" #include "stringbuffer.h"
#endif #endif
#if defined(__GNUC__)
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PUSH
#if defined(__GNUC__)
RAPIDJSON_DIAG_OFF(effc++) RAPIDJSON_DIAG_OFF(effc++)
#endif #endif
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(weak-vtables)
RAPIDJSON_DIAG_OFF(exit-time-destructors)
RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
RAPIDJSON_DIAG_OFF(variadic-macros) RAPIDJSON_DIAG_OFF(variadic-macros)
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated
#endif #endif
...@@ -1343,7 +1338,7 @@ public: ...@@ -1343,7 +1338,7 @@ public:
\param remoteProvider An optional remote schema document provider for resolving remote reference. Can be null. \param remoteProvider An optional remote schema document provider for resolving remote reference. Can be null.
\param allocator An optional allocator instance for allocating memory. Can be null. \param allocator An optional allocator instance for allocating memory. Can be null.
*/ */
GenericSchemaDocument(const ValueType& document, IRemoteSchemaDocumentProviderType* remoteProvider = 0, Allocator* allocator = 0) RAPIDJSON_NOEXCEPT : GenericSchemaDocument(const ValueType& document, IRemoteSchemaDocumentProviderType* remoteProvider = 0, Allocator* allocator = 0) :
remoteProvider_(remoteProvider), remoteProvider_(remoteProvider),
allocator_(allocator), allocator_(allocator),
ownAllocator_(), ownAllocator_(),
...@@ -2006,17 +2001,6 @@ private: ...@@ -2006,17 +2001,6 @@ private:
}; };
RAPIDJSON_NAMESPACE_END RAPIDJSON_NAMESPACE_END
#if defined(__GNUC__)
RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_POP
#endif
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
#ifdef _MSC_VER
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_SCHEMA_H_ #endif // RAPIDJSON_SCHEMA_H_
...@@ -302,8 +302,9 @@ TEST(EncodingsTest, UTF8) { ...@@ -302,8 +302,9 @@ TEST(EncodingsTest, UTF8) {
decodedCount++; decodedCount++;
} }
if (*encodedStr) // This decoder cannot handle U+0000 if (*encodedStr) { // This decoder cannot handle U+0000
EXPECT_EQ(1u, decodedCount); // Should only contain one code point EXPECT_EQ(1u, decodedCount); // Should only contain one code point
}
EXPECT_EQ(UTF8_ACCEPT, state); EXPECT_EQ(UTF8_ACCEPT, state);
if (UTF8_ACCEPT != state) if (UTF8_ACCEPT != state)
......
...@@ -50,8 +50,9 @@ static void TestStringStream() { ...@@ -50,8 +50,9 @@ static void TestStringStream() {
StringStreamType iss(s); StringStreamType iss(s);
BasicIStreamWrapper<StringStreamType> is(iss); BasicIStreamWrapper<StringStreamType> is(iss);
EXPECT_EQ(0, is.Tell()); EXPECT_EQ(0, is.Tell());
if (sizeof(Ch) == 1) if (sizeof(Ch) == 1) {
EXPECT_EQ(0, is.Peek4()); // less than 4 bytes EXPECT_EQ(0, is.Peek4()); // less than 4 bytes
}
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
EXPECT_EQ(static_cast<size_t>(i), is.Tell()); EXPECT_EQ(static_cast<size_t>(i), is.Tell());
EXPECT_EQ('A' + i, is.Peek()); EXPECT_EQ('A' + i, is.Peek());
......
...@@ -23,15 +23,17 @@ ...@@ -23,15 +23,17 @@
using namespace rapidjson; using namespace rapidjson;
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_PUSH
#ifdef __GNUC__
RAPIDJSON_DIAG_OFF(effc++) RAPIDJSON_DIAG_OFF(effc++)
RAPIDJSON_DIAG_OFF(float-equal) RAPIDJSON_DIAG_OFF(float-equal)
RAPIDJSON_DIAG_OFF(missing-noreturn) RAPIDJSON_DIAG_OFF(missing-noreturn)
#if __GNUC__ >= 6
RAPIDJSON_DIAG_OFF(dangling-else)
#endif #endif
#endif // __GNUC__
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(variadic-macros) RAPIDJSON_DIAG_OFF(variadic-macros)
RAPIDJSON_DIAG_OFF(c++98-compat-pedantic) RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
#endif #endif
...@@ -1839,10 +1841,4 @@ TEST(Reader, ParseNanAndInfinity) { ...@@ -1839,10 +1841,4 @@ TEST(Reader, ParseNanAndInfinity) {
#undef TEST_NAN_INF #undef TEST_NAN_INF
} }
#ifdef __GNUC__
RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_POP
#endif
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment