From 226a60baf50c9c91a98c01c3dd9c0ced750f8d0e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 21 Oct 2019 15:19:18 +0200 Subject: Replace Q_ALIGNOF usage in qtbase with C++11 alignof keyword The macro is not documented, so not part of the public Qt API. It is made obsolete by the alignof keyword in C++11. Remove the usage of the macro across qtbase, in particular the workarounds for compilers that didn't support alignof, and that will not be supported in Qt 6. The macro definition is left in place, no need to break existing code. Task-number: QTBUG-76414 Change-Id: I1cfedcd4dd748128696cdfb546d97aae4f98c3da Reviewed-by: Allan Sandfeld Jensen --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/kernel/qmetatype') diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 12c29a6e13..2a4ee55fa8 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1024,9 +1024,9 @@ static void testConstructHelper() typedef typename MetaEnumToType::Type Type; QMetaType info(ID); int size = info.sizeOf(); - void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type)); + void *storage1 = qMallocAligned(size, alignof(Type)); void *actual1 = QMetaType::construct(ID, storage1, /*copy=*/0); - void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type)); + void *storage2 = qMallocAligned(size, alignof(Type)); void *actual2 = info.construct(storage2, /*copy=*/0); QCOMPARE(actual1, storage1); QCOMPARE(actual2, storage2); @@ -1178,9 +1178,9 @@ static void testConstructCopyHelper() QMetaType info(ID); int size = QMetaType::sizeOf(ID); QCOMPARE(info.sizeOf(), size); - void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type)); + void *storage1 = qMallocAligned(size, alignof(Type)); void *actual1 = QMetaType::construct(ID, storage1, expected); - void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type)); + void *storage2 = qMallocAligned(size, alignof(Type)); void *actual2 = info.construct(storage2, expected); QCOMPARE(actual1, storage1); QCOMPARE(actual2, storage2); -- cgit v1.2.3 From b76f66272692f39aaaaec7c398702f1585badf45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 13 Jun 2019 12:37:26 +0200 Subject: Fix all tst_qmetatype breakages after QList to QVector aliasing In Qt6 QList is just a typedef to QVector. To keep Qt5 behavior compatibility we need to register aliases, otherwise some type name based operations would not work. The patch adds automatic registration of QList metatype alias for every QVector. The patch doesn't cover usage of already typedef'ed and aliased QList and QVector, but that should be quite esoteric, especially after introduction of automatic QList and QVector type registration. Change-Id: I84672dda2b159d94e76cdc6034861e7d7ef52533 Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/kernel/qmetatype') diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 2a4ee55fa8..d300c31001 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -572,12 +572,14 @@ void tst_QMetaType::typeName_data() QTest::newRow("124125534") << 124125534 << QString(); // automatic registration - QTest::newRow("QList") << ::qMetaTypeId >() << QString::fromLatin1("QList"); QTest::newRow("QHash") << ::qMetaTypeId >() << QString::fromLatin1("QHash"); QTest::newRow("QMap") << ::qMetaTypeId >() << QString::fromLatin1("QMap"); - QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QVector >"); QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QVector >"); + // automatic registration with automatic QList to QVector aliasing + QTest::newRow("QList") << ::qMetaTypeId >() << QString::fromLatin1("QVector"); + QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QVector >"); + QTest::newRow("CustomQObject*") << ::qMetaTypeId() << QString::fromLatin1("CustomQObject*"); QTest::newRow("CustomGadget") << ::qMetaTypeId() << QString::fromLatin1("CustomGadget"); QTest::newRow("CustomGadget*") << ::qMetaTypeId() << QString::fromLatin1("CustomGadget*"); -- cgit v1.2.3