diff options
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 12 | ||||
-rw-r--r-- | src/corelib/global/qendian.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qrandom.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qbytearraymatcher.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_ssse3.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/tools/collections/tst_collections.cpp | 13 |
6 files changed, 9 insertions, 26 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index b173dcf522..ad3d2be69b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -91,7 +91,6 @@ # define Q_OUTOFLINE_TEMPLATE inline # define Q_COMPILER_MANGLES_RETURN_TYPE # define Q_FUNC_INFO __FUNCSIG__ -# define Q_DECL_ALIGN(n) __declspec(align(n)) # define Q_ASSUME_IMPL(expr) __assume(expr) # define Q_UNREACHABLE_IMPL() __assume(0) # define Q_NORETURN __declspec(noreturn) @@ -223,7 +222,6 @@ # define Q_FUNC_INFO __PRETTY_FUNCTION__ # define Q_TYPEOF(expr) __typeof__(expr) # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) -# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) # define Q_DECL_UNUSED __attribute__((__unused__)) # define Q_LIKELY(expr) __builtin_expect(!!(expr), true) # define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) @@ -271,7 +269,6 @@ # error "Compiler not supported" # elif __xlC__ >= 0x0600 # define Q_TYPEOF(expr) __typeof__(expr) -# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) # define Q_PACKED __attribute__((__packed__)) # endif @@ -447,7 +444,6 @@ /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ # if __SUNPRO_CC >= 0x590 # define Q_TYPEOF(expr) __typeof__(expr) -# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) # endif # if __SUNPRO_CC >= 0x550 # define Q_DECL_EXPORT __global @@ -484,9 +480,6 @@ # define Q_DECL_EXPORT __declspec(dllexport) # define Q_DECL_IMPORT __declspec(dllimport) # endif -# if __HP_aCC-0 >= 061200 -# define Q_DECL_ALIGN(n) __attribute__((aligned(n))) -# endif # if __HP_aCC-0 >= 062000 # define Q_DECL_EXPORT __attribute__((visibility("default"))) # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) @@ -1127,9 +1120,8 @@ # define Q_ALIGNOF(x) alignof(x) #endif -#if defined(Q_COMPILER_ALIGNAS) -# undef Q_DECL_ALIGN -# define Q_DECL_ALIGN(n) alignas(n) +#ifndef Q_DECL_ALIGN +# define Q_DECL_ALIGN(n) alignas(n) #endif #if QT_HAS_CPP_ATTRIBUTE(nodiscard) && !defined(Q_CC_CLANG) // P0188R1 diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 7fd6e13d3b..c56a7ffbf7 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -765,7 +765,7 @@ QT_BEGIN_NAMESPACE #if defined(__SSSE3__) using ShuffleMask = uchar[16]; -Q_DECL_ALIGN(16) static const ShuffleMask shuffleMasks[3] = { +alignas(16) static const ShuffleMask shuffleMasks[3] = { // 16-bit {1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14}, // 32-bit diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 3cbd40b772..563e5eb7ed 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -355,7 +355,7 @@ struct QRandomGenerator::SystemAndGlobalGenerators // the state in case another thread tries to lock the mutex. It's not // a common scenario, but since sizeof(QRandomGenerator) >= 2560, the // overhead is actually acceptable. - // 2) We use both Q_DECL_ALIGN and std::aligned_storage<..., 64> because + // 2) We use both alignas and std::aligned_storage<..., 64> because // some implementations of std::aligned_storage can't align to more // than a primitive type's alignment. // 3) We don't store the entire system QRandomGenerator, only the space @@ -364,7 +364,7 @@ struct QRandomGenerator::SystemAndGlobalGenerators QBasicMutex globalPRNGMutex; struct ShortenedSystem { uint type; } system_; SystemGenerator sys; - Q_DECL_ALIGN(64) std::aligned_storage<sizeof(QRandomGenerator64), 64>::type global_; + alignas(64) std::aligned_storage<sizeof(QRandomGenerator64), 64>::type global_; #ifdef Q_COMPILER_CONSTEXPR constexpr SystemAndGlobalGenerators() diff --git a/src/corelib/text/qbytearraymatcher.h b/src/corelib/text/qbytearraymatcher.h index 0eedfc1d20..7cc5037095 100644 --- a/src/corelib/text/qbytearraymatcher.h +++ b/src/corelib/text/qbytearraymatcher.h @@ -85,7 +85,7 @@ private: class QStaticByteArrayMatcherBase { - Q_DECL_ALIGN(16) + alignas(16) struct Skiptable { uchar data[256]; } m_skiptable; diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index 14d7047bb6..a175b591dd 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -197,7 +197,7 @@ void qt_memfill24_ssse3(quint24 *dest, quint24 color, qsizetype count) quint24 *end = dest + count; constexpr uchar x = 2, y = 1, z = 0; - Q_DECL_ALIGN(__m128i) static const uchar + alignas(__m128i) static const uchar shuffleMask[16 + 1] = { x, y, z, x, y, z, x, y, z, x, y, z, x, y, z, x, y }; __m128i mval1 = _mm_shuffle_epi8(m, _mm_load_si128(reinterpret_cast<const __m128i *>(shuffleMask))); diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 8aca12f9d6..a9adda2750 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -3214,9 +3214,7 @@ void tst_Collections::forwardDeclared() { typedef QSet<T1> C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) } } -#if defined(Q_DECL_ALIGN) - -class Q_DECL_ALIGN(4) Aligned4 +class alignas(4) Aligned4 { char i; public: @@ -3242,7 +3240,7 @@ Q_STATIC_ASSERT(alignof(Aligned4) % 4 == 0); # define BIGGEST_ALIGNMENT_TO_TEST 128 #endif -class Q_DECL_ALIGN(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest +class alignas(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest { char i; public: @@ -3325,13 +3323,6 @@ void tst_Collections::alignment() testAssociativeContainerAlignment<QHash<AlignedBiggest, AlignedBiggest> >(); } -#else -void tst_Collections::alignment() -{ - QSKIP("Compiler doesn't support necessary extension keywords"); -} -#endif - #ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS template<template<class> class C> |