QArrayDataOps: silence Clang warning about memmove

Same as 9224255f13952e5b4092208c8cae1a31ab5c6a19: some Qt types are
polymorphic and are marked as movable, so Clang complains.

qarraydataops.h:608:27: error: destination for this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be overwritten [-Werror,-Wdynamic-class-memaccess]
qarraydataops.h:608:61: error: source of this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be moved [-Werror,-Wdynamic-class-memaccess]

Change-Id: Ib57b52598e2f452985e9fffd145861e025b81550
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Thiago Macieira 2016-06-15 15:21:34 -07:00
parent 7b23ebefb2
commit 6cbc9c6d35

View File

@ -319,7 +319,8 @@ struct QMovableArrayOps
, end(finish)
, displace(diff)
{
::memmove(begin + displace, begin, (end - begin) * sizeof(T));
::memmove(static_cast<void *>(begin + displace), static_cast<void *>(begin),
(end - begin) * sizeof(T));
}
void commit() { displace = 0; }
@ -327,7 +328,8 @@ struct QMovableArrayOps
~ReversibleDisplace()
{
if (displace)
::memmove(begin, begin + displace, (end - begin) * sizeof(T));
::memmove(static_cast<void *>(begin), static_cast<void *>(begin + displace),
(end - begin) * sizeof(T));
}
T *const begin;
@ -384,7 +386,7 @@ struct QMovableArrayOps
~Mover()
{
::memmove(destination, source, n * sizeof(T));
::memmove(static_cast<void *>(destination), static_cast<const void *>(source), n * sizeof(T));
size -= (source - destination);
}