guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: gnu: rapidjson: Adjust for GCC 10.


From: guix-commits
Subject: 01/02: gnu: rapidjson: Adjust for GCC 10.
Date: Wed, 11 Aug 2021 17:24:11 -0400 (EDT)

mbakke pushed a commit to branch master
in repository guix.

commit 443e7f6338049d39427439fc5d997f8c59916fe1
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Wed Aug 11 09:59:42 2021 +0200

    gnu: rapidjson: Adjust for GCC 10.
    
    * gnu/packages/patches/rapidjson-gcc-compat.patch: Add additional patch.
---
 gnu/packages/patches/rapidjson-gcc-compat.patch | 48 +++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/patches/rapidjson-gcc-compat.patch 
b/gnu/packages/patches/rapidjson-gcc-compat.patch
index b5ffc0a..8bfdb07 100644
--- a/gnu/packages/patches/rapidjson-gcc-compat.patch
+++ b/gnu/packages/patches/rapidjson-gcc-compat.patch
@@ -16,3 +16,51 @@ index 422a5240..d4039716 100644
  #endif
  
  #ifdef _MSC_VER
+
+Cast destination pointers to avoid a GCC error about memmove writing to
+a different type.
+
+Adapted from this upstream commit:
+https://github.com/Tencent/rapidjson/commit/fa5963a2f5b231ee2babff771f169ccca22870ed
+
+diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h
+--- a/include/rapidjson/document.h
++++ b/include/rapidjson/document.h
+@@ -1425,7 +1425,7 @@ public:
+         MemberIterator pos = MemberBegin() + (first - MemberBegin());
+         for (MemberIterator itr = pos; itr != last; ++itr)
+             itr->~Member();
+-        std::memmove(&*pos, &*last, static_cast<size_t>(MemberEnd() - last) * 
sizeof(Member));
++        std::memmove(static_cast<void*>(&*pos), &*last, 
static_cast<size_t>(MemberEnd() - last) * sizeof(Member));
+         data_.o.size -= static_cast<SizeType>(last - first);
+         return pos;
+     }
+@@ -1628,8 +1628,8 @@ public:
+         RAPIDJSON_ASSERT(last <= End());
+         ValueIterator pos = Begin() + (first - Begin());
+         for (ValueIterator itr = pos; itr != last; ++itr)
+-            itr->~GenericValue();       
+-        std::memmove(pos, last, static_cast<size_t>(End() - last) * 
sizeof(GenericValue));
++            itr->~GenericValue();
++        std::memmove(static_cast<void*>(pos), last, static_cast<size_t>(End() 
- last) * sizeof(GenericValue));
+         data_.a.size -= static_cast<SizeType>(last - first);
+         return pos;
+     }
+@@ -1936,7 +1936,7 @@ private:
+         if (count) {
+             GenericValue* e = 
static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
+             SetElementsPointer(e);
+-            std::memcpy(e, values, count * sizeof(GenericValue));
++            std::memcpy(static_cast<void*>(e), values, count * 
sizeof(GenericValue));
+         }
+         else
+             SetElementsPointer(0);
+@@ -1949,7 +1949,7 @@ private:
+         if (count) {
+             Member* m = static_cast<Member*>(allocator.Malloc(count * 
sizeof(Member)));
+             SetMembersPointer(m);
+-            std::memcpy(m, members, count * sizeof(Member));
++            std::memcpy(static_cast<void*>(m), members, count * 
sizeof(Member));
+         }
+         else
+             SetMembersPointer(0);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]