diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2019-10-21 15:19:18 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2019-10-29 10:37:02 +0100 |
commit | 226a60baf50c9c91a98c01c3dd9c0ced750f8d0e (patch) | |
tree | d9c57735a34f963eaafbe895f094d0009d262408 /tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp | |
parent | 8bcecd86fac60475a7236787b4b89460fa89d612 (diff) |
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 <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp')
-rw-r--r-- | tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp index bef491d5f0..22ee7d17b7 100644 --- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp @@ -237,28 +237,23 @@ template <typename T> struct TypeInStruct { T type; }; void tst_QAtomicInt::alignment() { -#ifdef Q_ALIGNOF - // this will cause a build error if the alignment isn't the same - char dummy1[Q_ALIGNOF(QBasicAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1]; - char dummy2[Q_ALIGNOF(QAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1]; - (void)dummy1; (void)dummy2; + Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>)); + Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>)); #ifdef Q_ATOMIC_INT32_IS_SUPPORTED - QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<int>), Q_ALIGNOF(TypeInStruct<int>)); + QCOMPARE(alignof(QBasicAtomicInteger<int>), alignof(TypeInStruct<int>)); #endif #ifdef Q_ATOMIC_INT16_IS_SUPPORTED - QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<short>), Q_ALIGNOF(TypeInStruct<short>)); + QCOMPARE(alignof(QBasicAtomicInteger<short>), alignof(TypeInStruct<short>)); #endif #ifdef Q_ATOMIC_INT8_IS_SUPPORTED - QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<char>), Q_ALIGNOF(TypeInStruct<char>)); + QCOMPARE(alignof(QBasicAtomicInteger<char>), alignof(TypeInStruct<char>)); #endif #ifdef Q_ATOMIC_INT64_IS_SUPPORTED - QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<qlonglong>), Q_ALIGNOF(TypeInStruct<qlonglong>)); -#endif - + QCOMPARE(alignof(QBasicAtomicInteger<qlonglong>), alignof(TypeInStruct<qlonglong>)); #endif } |