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 --- .../gui/kernel/qguimetatype/tst_qguimetatype.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp') diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index 1d0484a05d..2645bb111e 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -316,30 +316,10 @@ void tst_QGuiMetaType::sizeOf() QCOMPARE(QMetaType::sizeOf(type), size); } -#ifndef Q_ALIGNOF -template -struct RoundToNextHighestPowerOfTwo -{ -private: - enum { V1 = N-1 }; - enum { V2 = V1 | (V1 >> 1) }; - enum { V3 = V2 | (V2 >> 2) }; - enum { V4 = V3 | (V3 >> 4) }; - enum { V5 = V4 | (V4 >> 8) }; - enum { V6 = V5 | (V5 >> 16) }; -public: - enum { Value = V6 + 1 }; -}; -#endif - template struct TypeAlignment { -#ifdef Q_ALIGNOF - enum { Value = Q_ALIGNOF(T) }; -#else - enum { Value = RoundToNextHighestPowerOfTwo::Value }; -#endif + enum { Value = alignof(T) }; }; void tst_QGuiMetaType::flags_data() -- cgit v1.2.3