From 5f501b0e975f8985c468218a103a497ca123cf7b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 27 Feb 2021 18:00:25 +0100 Subject: [PATCH 1/3] QQuaternion: mark as PRIMITIVE type Change-Id: I043fef8bfc66875b72f34e7939e78c7d1c7f5381 Reviewed-by: Thiago Macieira --- src/gui/math3d/qquaternion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 76fa237afd0..4d04ac6ad98 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -169,7 +169,7 @@ private: float wp, xp, yp, zp; }; -Q_DECLARE_TYPEINFO(QQuaternion, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QQuaternion, Q_PRIMITIVE_TYPE); inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {} From 23636d42815461710167e26df4a937cd6d975b37 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 1 Mar 2021 09:27:17 +0100 Subject: [PATCH 2/3] tst_qmetatype: RELOCATABLE -> PRIMITIVE is binary compatible Based on the discussion in https://codereview.qt-project.org/c/qt/qtbase/+/336742 changing our types from RELOCATABLE to PRIMITVE is fine. Change-Id: Ica867203aa813d19fdfd3753fc4ff36ef4332fc3 Reviewed-by: Lars Knoll --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 81a67f1b781..df9beabe737 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1092,9 +1092,18 @@ void tst_QMetaType::flagsBinaryCompatibility6_0() QFETCH(quint32, id); QFETCH(quint32, flags); + const auto currentFlags = QMetaType::typeFlags(id); + auto expectedFlags = QMetaType::TypeFlags(flags); + if (!(currentFlags.testFlag(QMetaType::NeedsConstruction) && currentFlags.testFlag(QMetaType::NeedsDestruction))) { + if (expectedFlags.testFlag(QMetaType::NeedsConstruction) && expectedFlags.testFlag(QMetaType::NeedsDestruction)) { + // If type changed from RELOCATABLE to trivial, that's fine + expectedFlags.setFlag(QMetaType::NeedsConstruction, false); + expectedFlags.setFlag(QMetaType::NeedsDestruction, false); + } + } quint32 mask_5_0 = 0x1fb; // Only compare the values that were already defined in 5.0 - QCOMPARE(quint32(QMetaType::typeFlags(id)) & mask_5_0, flags & mask_5_0); + QCOMPARE(quint32(currentFlags) & mask_5_0, quint32(expectedFlags) & mask_5_0); } void tst_QMetaType::construct_data() From 48f685f5e51a98ea0e57e95724d801d249d30c0d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 27 Feb 2021 17:47:04 +0100 Subject: [PATCH 3/3] QPoint(F): declare as PRIMITIVE, not RELOCATABLE These types can be copied via memcpy, so use the correct tag. Change-Id: Icba37d42dd8658225ce4889284661d108122d489 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll Reviewed-by: Andrei Golubev --- src/corelib/tools/qpoint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 8fff462487c..f2c562393ab 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -129,7 +129,7 @@ private: } }; -Q_DECLARE_TYPEINFO(QPoint, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QPoint, Q_PRIMITIVE_TYPE); /***************************************************************************** QPoint stream functions @@ -326,7 +326,7 @@ private: } }; -Q_DECLARE_TYPEINFO(QPointF, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QPointF, Q_PRIMITIVE_TYPE); size_t qHash(QPointF, size_t seed = 0) = delete;