Merge "QPoint(F): declare as PRIMITIVE, not RELOCATABLE"

This commit is contained in:
Giuseppe D'Angelo 2021-02-27 17:47:04 +01:00 committed by Qt CI Bot
commit bcedeb6d3d
3 changed files with 13 additions and 4 deletions

View File

@ -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;

View File

@ -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) {}

View File

@ -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()