From 89afda0694c922afe66cde29e6ac40044bb2978c Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Thu, 31 Mar 2016 10:25:55 +0800 Subject: [PATCH 01/11] Add CMAKE verbose for appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 13d8b94..205c670 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,7 @@ environment: before_build: - git submodule update --init --recursive -- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DBUILD_SHARED_LIBS=true -Wno-dev +- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -Wno-dev build: project: Build\VS\RapidJSON.sln From d7df1f26ba56922aed0bcdb2b39cf46bd78e36c6 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Thu, 31 Mar 2016 14:20:24 +0800 Subject: [PATCH 02/11] Add /W4 and /WX for VC --- test/unittest/CMakeLists.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index 3f76a4f..ff49bb9 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -38,12 +38,26 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything") - # If the user is running a newer version of Clang that includes the - # -Wdouble-promotion, we will ignore that warning. - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7) + # If the user is running a newer version of Clang that includes the + # -Wdouble-promotion, we will ignore that warning. + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.7) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion") - endif() + endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Force to always compile with /W4 + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() + + # Force to always compile with /WX + if(CMAKE_CXX_FLAGS MATCHES "/WX-") + string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() + add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() From 2418d7cd91a2b8c5a7e19f3656e57ead051538b1 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Thu, 31 Mar 2016 15:02:03 +0800 Subject: [PATCH 03/11] Fix cmake --- test/unittest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index ff49bb9..f1918cc 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -53,7 +53,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Force to always compile with /WX if(CMAKE_CXX_FLAGS MATCHES "/WX-") - string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS + string(REGEX REPLACE "/WX-" "/WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") endif() From c843a2655bf58efd0ced40c5b55706eef45f0978 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Mon, 4 Apr 2016 15:01:34 +0800 Subject: [PATCH 04/11] Try to fix all /W4 warnings in VC2015 --- CMakeLists.txt | 1 + example/CMakeLists.txt | 2 -- include/rapidjson/document.h | 5 ++-- include/rapidjson/schema.h | 3 ++- test/unittest/CMakeLists.txt | 2 -- test/unittest/documenttest.cpp | 40 ++++++++++++++-------------- test/unittest/istreamwrappertest.cpp | 11 +++++++- test/unittest/readertest.cpp | 2 +- test/unittest/valuetest.cpp | 10 +++---- 9 files changed, 41 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa2bdcf..6bdf484 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") endif() #add extra search paths for libraries and includes diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 8c546cf..6da18df 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -23,8 +23,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything") -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() foreach (example ${EXAMPLES}) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index e1b1fbc..0ce2d2a 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -1794,7 +1794,7 @@ private: template friend class GenericValue; template friend class GenericDocument; - enum { + static const uint16_t kBoolFlag = 0x0008, kNumberFlag = 0x0010, kIntFlag = 0x0020, @@ -1822,8 +1822,7 @@ private: kObjectFlag = kObjectType, kArrayFlag = kArrayType, - kTypeMask = 0x07 - }; + kTypeMask = 0x07; static const SizeType kDefaultArrayCapacity = 16; static const SizeType kDefaultObjectCapacity = 16; diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index 26da8a6..acbae36 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -1963,7 +1963,8 @@ public: GenericSchemaValidator validator(sd_, handler); parseResult_ = reader.template Parse(is_, validator); - if ((isValid_ = validator.IsValid())) { + isValid_ = validator.IsValid(); + if (isValid_) { invalidSchemaPointer_ = PointerType(); invalidSchemaKeyword_ = 0; invalidDocumentPointer_ = PointerType(); diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index f1918cc..3630cfe 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -57,8 +57,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") endif() - - add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRAPIDJSON_HAS_STDSTRING=1") diff --git a/test/unittest/documenttest.cpp b/test/unittest/documenttest.cpp index 0c9ffab..ecd4b79 100644 --- a/test/unittest/documenttest.cpp +++ b/test/unittest/documenttest.cpp @@ -447,10 +447,10 @@ TYPED_TEST_CASE(DocumentMove, MoveAllocatorTypes); TYPED_TEST(DocumentMove, MoveConstructor) { typedef TypeParam Allocator; - typedef GenericDocument, Allocator> Document; + typedef GenericDocument, Allocator> D; Allocator allocator; - Document a(&allocator); + D a(&allocator); a.Parse("[\"one\", \"two\", \"three\"]"); EXPECT_FALSE(a.HasParseError()); EXPECT_TRUE(a.IsArray()); @@ -458,7 +458,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) { EXPECT_EQ(&a.GetAllocator(), &allocator); // Document b(a); // does not compile (!is_copy_constructible) - Document b(std::move(a)); + D b(std::move(a)); EXPECT_TRUE(a.IsNull()); EXPECT_TRUE(b.IsArray()); EXPECT_EQ(3u, b.Size()); @@ -471,7 +471,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) { EXPECT_EQ(2u, b.MemberCount()); // Document c = a; // does not compile (!is_copy_constructible) - Document c = std::move(b); + D c = std::move(b); EXPECT_TRUE(b.IsNull()); EXPECT_TRUE(c.IsObject()); EXPECT_EQ(2u, c.MemberCount()); @@ -481,17 +481,17 @@ TYPED_TEST(DocumentMove, MoveConstructor) { TYPED_TEST(DocumentMove, MoveConstructorParseError) { typedef TypeParam Allocator; - typedef GenericDocument, Allocator> Document; + typedef GenericDocument, Allocator> D; ParseResult noError; - Document a; + D a; a.Parse("{ 4 = 4]"); ParseResult error(a.GetParseError(), a.GetErrorOffset()); EXPECT_TRUE(a.HasParseError()); EXPECT_NE(error.Code(), noError.Code()); EXPECT_NE(error.Offset(), noError.Offset()); - Document b(std::move(a)); + D b(std::move(a)); EXPECT_FALSE(a.HasParseError()); EXPECT_TRUE(b.HasParseError()); EXPECT_EQ(a.GetParseError(), noError.Code()); @@ -499,7 +499,7 @@ TYPED_TEST(DocumentMove, MoveConstructorParseError) { EXPECT_EQ(a.GetErrorOffset(), noError.Offset()); EXPECT_EQ(b.GetErrorOffset(), error.Offset()); - Document c(std::move(b)); + D c(std::move(b)); EXPECT_FALSE(b.HasParseError()); EXPECT_TRUE(c.HasParseError()); EXPECT_EQ(b.GetParseError(), noError.Code()); @@ -540,10 +540,10 @@ TYPED_TEST(DocumentMove, MoveConstructorStack) { TYPED_TEST(DocumentMove, MoveAssignment) { typedef TypeParam Allocator; - typedef GenericDocument, Allocator> Document; + typedef GenericDocument, Allocator> D; Allocator allocator; - Document a(&allocator); + D a(&allocator); a.Parse("[\"one\", \"two\", \"three\"]"); EXPECT_FALSE(a.HasParseError()); EXPECT_TRUE(a.IsArray()); @@ -551,7 +551,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) { EXPECT_EQ(&a.GetAllocator(), &allocator); // Document b; b = a; // does not compile (!is_copy_assignable) - Document b; + D b; b = std::move(a); EXPECT_TRUE(a.IsNull()); EXPECT_TRUE(b.IsArray()); @@ -565,7 +565,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) { EXPECT_EQ(2u, b.MemberCount()); // Document c; c = a; // does not compile (see static_assert) - Document c; + D c; c = std::move(b); EXPECT_TRUE(b.IsNull()); EXPECT_TRUE(c.IsObject()); @@ -576,17 +576,17 @@ TYPED_TEST(DocumentMove, MoveAssignment) { TYPED_TEST(DocumentMove, MoveAssignmentParseError) { typedef TypeParam Allocator; - typedef GenericDocument, Allocator> Document; + typedef GenericDocument, Allocator> D; ParseResult noError; - Document a; + D a; a.Parse("{ 4 = 4]"); ParseResult error(a.GetParseError(), a.GetErrorOffset()); EXPECT_TRUE(a.HasParseError()); EXPECT_NE(error.Code(), noError.Code()); EXPECT_NE(error.Offset(), noError.Offset()); - Document b; + D b; b = std::move(a); EXPECT_FALSE(a.HasParseError()); EXPECT_TRUE(b.HasParseError()); @@ -595,7 +595,7 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) { EXPECT_EQ(a.GetErrorOffset(), noError.Offset()); EXPECT_EQ(b.GetErrorOffset(), error.Offset()); - Document c; + D c; c = std::move(b); EXPECT_FALSE(b.HasParseError()); EXPECT_TRUE(c.HasParseError()); @@ -612,9 +612,9 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) { TYPED_TEST(DocumentMove, MoveAssignmentStack) { typedef TypeParam Allocator; typedef UTF8<> Encoding; - typedef GenericDocument Document; + typedef GenericDocument D; - Document a; + D a; size_t defaultCapacity = a.GetStackCapacity(); // Trick Document into getting GetStackCapacity() to return non-zero @@ -625,12 +625,12 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) { size_t capacity = a.GetStackCapacity(); EXPECT_GT(capacity, 0u); - Document b; + D b; b = std::move(a); EXPECT_EQ(a.GetStackCapacity(), defaultCapacity); EXPECT_EQ(b.GetStackCapacity(), capacity); - Document c; + D c; c = std::move(b); EXPECT_EQ(b.GetStackCapacity(), defaultCapacity); EXPECT_EQ(c.GetStackCapacity(), capacity); diff --git a/test/unittest/istreamwrappertest.cpp b/test/unittest/istreamwrappertest.cpp index f6b0fa9..28c756c 100644 --- a/test/unittest/istreamwrappertest.cpp +++ b/test/unittest/istreamwrappertest.cpp @@ -20,6 +20,11 @@ #include #include +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4702) // unreachable code +#endif + using namespace rapidjson; using namespace std; @@ -168,4 +173,8 @@ TEST(IStreamWrapper, wfstream) { EXPECT_EQ(5, d.MemberCount()); } -#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS +#endif + +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index 3f11fec..329af2a 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -720,7 +720,7 @@ TEST(Reader, ParseString_Error) { TEST_STRINGENCODING_ERROR(UTF32<>, UTF8<>, unsigned, ARRAY('[', '\"', 0x110000, '\"', ']', '\0')); // Malform ASCII sequence - TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x80), '\"', ']', '\0')); + TEST_STRINGENCODING_ERROR(ASCII<>, UTF8<>, char, ARRAY('[', '\"', char(0x80u), '\"', ']', '\0')); #undef ARRAY #undef TEST_STRINGARRAY_ERROR diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp index d6c7492..aac0a44 100644 --- a/test/unittest/valuetest.cpp +++ b/test/unittest/valuetest.cpp @@ -94,23 +94,23 @@ TEST(Value, Traits) { #endif TEST(Value, MoveConstructor) { - typedef GenericValue, CrtAllocator> Value; - Value::AllocatorType allocator; + typedef GenericValue, CrtAllocator> V; + V::AllocatorType allocator; - Value x((Value(kArrayType))); + V x((V(kArrayType))); x.Reserve(4u, allocator); x.PushBack(1, allocator).PushBack(2, allocator).PushBack(3, allocator).PushBack(4, allocator); EXPECT_TRUE(x.IsArray()); EXPECT_EQ(4u, x.Size()); // Value y(x); // does not compile (!is_copy_constructible) - Value y(std::move(x)); + V y(std::move(x)); EXPECT_TRUE(x.IsNull()); EXPECT_TRUE(y.IsArray()); EXPECT_EQ(4u, y.Size()); // Value z = y; // does not compile (!is_copy_assignable) - Value z = std::move(y); + V z = std::move(y); EXPECT_TRUE(y.IsNull()); EXPECT_TRUE(z.IsArray()); EXPECT_EQ(4u, z.Size()); From 8991037ecd1a3a2bec97813b61c2a1993ad7fb6d Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Tue, 5 Apr 2016 23:26:08 +0800 Subject: [PATCH 05/11] Revert using of static const back to enum due to gcc error --- include/rapidjson/document.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 0ce2d2a..e23e1ad 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -27,6 +27,7 @@ #ifdef _MSC_VER RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant +RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data #endif #ifdef __clang__ @@ -1794,17 +1795,17 @@ private: template friend class GenericValue; template friend class GenericDocument; - static const uint16_t - kBoolFlag = 0x0008, - kNumberFlag = 0x0010, - kIntFlag = 0x0020, - kUintFlag = 0x0040, - kInt64Flag = 0x0080, - kUint64Flag = 0x0100, - kDoubleFlag = 0x0200, - kStringFlag = 0x0400, - kCopyFlag = 0x0800, - kInlineStrFlag = 0x1000, + enum { + kBoolFlag = 0x0008, + kNumberFlag = 0x0010, + kIntFlag = 0x0020, + kUintFlag = 0x0040, + kInt64Flag = 0x0080, + kUint64Flag = 0x0100, + kDoubleFlag = 0x0200, + kStringFlag = 0x0400, + kCopyFlag = 0x0800, + kInlineStrFlag = 0x1000, // Initial flags of different types. kNullFlag = kNullType, @@ -1822,7 +1823,8 @@ private: kObjectFlag = kObjectType, kArrayFlag = kArrayType, - kTypeMask = 0x07; + kTypeMask = 0x07 + }; static const SizeType kDefaultArrayCapacity = 16; static const SizeType kDefaultObjectCapacity = 16; From 35ccca8b7430f8b354142131a632f542cf162206 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Tue, 5 Apr 2016 23:56:50 +0800 Subject: [PATCH 06/11] Try to fix VC warning C4512 --- include/rapidjson/document.h | 2 ++ include/rapidjson/encodedstream.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index e23e1ad..dda799c 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -322,6 +322,8 @@ private: //! Disallow construction from non-const array template GenericStringRef(CharType (&str)[N]) /* = delete */; + + GenericStringRef& operator=(const GenericStringRef&); }; //! Mark a character pointer as constant string diff --git a/include/rapidjson/encodedstream.h b/include/rapidjson/encodedstream.h index c402e5c..c12caac 100644 --- a/include/rapidjson/encodedstream.h +++ b/include/rapidjson/encodedstream.h @@ -84,6 +84,10 @@ public: Ch* PutBegin() { return 0; } size_t PutEnd(Ch*) { return 0; } +private: + EncodedInputStream(const EncodedInputStream&); + EncodedInputStream& operator=(const EncodedInputStream&); + MemoryStream& is_; }; From 689be10891d4ab03853edda4f08db74e7d83e8e0 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 6 Apr 2016 00:11:49 +0800 Subject: [PATCH 07/11] Fix a compilation error --- include/rapidjson/encodedstream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rapidjson/encodedstream.h b/include/rapidjson/encodedstream.h index c12caac..1450683 100644 --- a/include/rapidjson/encodedstream.h +++ b/include/rapidjson/encodedstream.h @@ -84,11 +84,11 @@ public: Ch* PutBegin() { return 0; } size_t PutEnd(Ch*) { return 0; } + MemoryStream& is_; + private: EncodedInputStream(const EncodedInputStream&); EncodedInputStream& operator=(const EncodedInputStream&); - - MemoryStream& is_; }; //! Output byte stream wrapper with statically bound encoding. From be5a886f8fedf6f963d277bba32e57ae6d232d76 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 6 Apr 2016 00:34:45 +0800 Subject: [PATCH 08/11] Fix clang compilation error --- include/rapidjson/document.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index dda799c..2d9bfe6 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -312,6 +312,10 @@ struct GenericStringRef { GenericStringRef(const CharType* str, SizeType len) : s(str), length(len) { RAPIDJSON_ASSERT(s != 0); } + GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {} + + GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } + //! implicit conversion to plain CharType pointer operator const Ch *() const { return s; } @@ -322,8 +326,6 @@ private: //! Disallow construction from non-const array template GenericStringRef(CharType (&str)[N]) /* = delete */; - - GenericStringRef& operator=(const GenericStringRef&); }; //! Mark a character pointer as constant string From 44d114f3ee7067380a234903997fb736a2787682 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 6 Apr 2016 00:47:16 +0800 Subject: [PATCH 09/11] Supress VC C4512 warning --- include/rapidjson/internal/regex.h | 9 +++++++++ include/rapidjson/pointer.h | 9 +++++++++ include/rapidjson/schema.h | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h index aeb0e3e..d317daa 100644 --- a/include/rapidjson/internal/regex.h +++ b/include/rapidjson/internal/regex.h @@ -31,6 +31,11 @@ RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(effc++) #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + #ifndef RAPIDJSON_REGEX_VERBOSE #define RAPIDJSON_REGEX_VERBOSE 0 #endif @@ -693,4 +698,8 @@ RAPIDJSON_NAMESPACE_END RAPIDJSON_DIAG_POP #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + #endif // RAPIDJSON_INTERNAL_REGEX_H_ diff --git a/include/rapidjson/pointer.h b/include/rapidjson/pointer.h index 9444938..c985277 100644 --- a/include/rapidjson/pointer.h +++ b/include/rapidjson/pointer.h @@ -23,6 +23,11 @@ RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(switch-enum) #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + RAPIDJSON_NAMESPACE_BEGIN static const SizeType kPointerInvalidIndex = ~SizeType(0); //!< Represents an invalid index in GenericPointer::Token @@ -1342,4 +1347,8 @@ RAPIDJSON_NAMESPACE_END RAPIDJSON_DIAG_POP #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + #endif // RAPIDJSON_POINTER_H_ diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index acbae36..e12e7d2 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -68,6 +68,11 @@ RAPIDJSON_DIAG_PUSH RAPIDJSON_DIAG_OFF(variadic-macros) #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_PUSH +RAPIDJSON_DIAG_OFF(4512) // assignment operator could not be generated +#endif + RAPIDJSON_NAMESPACE_BEGIN /////////////////////////////////////////////////////////////////////////////// @@ -2005,4 +2010,8 @@ RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_POP #endif +#ifdef _MSC_VER +RAPIDJSON_DIAG_POP +#endif + #endif // RAPIDJSON_SCHEMA_H_ From 49c29d057d3025d02b975bc9ed07e22ca166d317 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 6 Apr 2016 01:16:00 +0800 Subject: [PATCH 10/11] Fix VC warning C4189 --- test/unittest/unittest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unittest/unittest.cpp b/test/unittest/unittest.cpp index e0e8576..b754563 100644 --- a/test/unittest/unittest.cpp +++ b/test/unittest/unittest.cpp @@ -35,6 +35,7 @@ int main(int argc, char **argv) { #ifdef _MSC_VER _CrtMemState memoryState = { 0 }; + (void)memoryState; _CrtMemCheckpoint(&memoryState); //_CrtSetBreakAlloc(X); //void *testWhetherMemoryLeakDetectionWorks = malloc(1); From 12425693ba255b8b8d68ba8ce752a23a25c2118f Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 6 Apr 2016 23:33:26 +0800 Subject: [PATCH 11/11] Revert formatting of enum --- include/rapidjson/document.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 2d9bfe6..d286eb1 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -1800,16 +1800,16 @@ private: template friend class GenericDocument; enum { - kBoolFlag = 0x0008, - kNumberFlag = 0x0010, - kIntFlag = 0x0020, - kUintFlag = 0x0040, - kInt64Flag = 0x0080, - kUint64Flag = 0x0100, - kDoubleFlag = 0x0200, - kStringFlag = 0x0400, - kCopyFlag = 0x0800, - kInlineStrFlag = 0x1000, + kBoolFlag = 0x0008, + kNumberFlag = 0x0010, + kIntFlag = 0x0020, + kUintFlag = 0x0040, + kInt64Flag = 0x0080, + kUint64Flag = 0x0100, + kDoubleFlag = 0x0200, + kStringFlag = 0x0400, + kCopyFlag = 0x0800, + kInlineStrFlag = 0x1000, // Initial flags of different types. kNullFlag = kNullType,