From 0587d4752d8fb814d47a599130d98724d78b1525 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 Jun 2022 09:23:47 +0200 Subject: Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTED It's always true these days, assert so in qatomic.cpp and tst_QAtomicInteger. Update the docs. Pick-to: 6.4 Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1 Reviewed-by: Thiago Macieira --- src/corelib/thread/qatomic.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 8c0424c32c..0184774b44 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -39,11 +39,11 @@ \li pointer size: qintptr, quintptr, qptrdiff \endlist - Of the list above, only the 32-bit- and pointer-sized instantiations are guaranteed to - work on all platforms. Support for other sizes depends on the compiler and - processor architecture the code is being compiled for. To test whether the - other types are supported, check the macro \c Q_ATOMIC_INT\e{nn}_IS_SUPPORTED, - where \c{\e{nn}} is the number of bits desired. + Of the list above, only the 8-bit, 16-bit, 32-bit- and pointer-sized + instantiations are guaranteed to work on all platforms. Support for other + sizes depends on the compiler and processor architecture the code is being + compiled for. To test whether the 64-bit types are supported on 32-bit + platforms, check the macro \c Q_ATOMIC_INT64_IS_SUPPORTED. \section1 The Atomic API @@ -950,9 +950,16 @@ This macro is defined if atomic integers of size \e{nn} (in bits) are supported in this compiler / architecture combination. - Q_ATOMIC_INT32_IS_SUPPORTED is always defined. \e{nn} is the size of the integer, in bits (8, 16, 32 or 64). + + The following macros always defined: + + \list + \li Q_ATOMIC_INT8_IS_SUPPORTED + \li Q_ATOMIC_INT16_IS_SUPPORTED + \li Q_ATOMIC_INT32_IS_SUPPORTED + \endlist */ /*! @@ -1653,6 +1660,12 @@ */ // static checks +#ifndef Q_ATOMIC_INT8_IS_SUPPORTED +# error "Q_ATOMIC_INT8_IS_SUPPORTED must be defined" +#endif +#ifndef Q_ATOMIC_INT16_IS_SUPPORTED +# error "Q_ATOMIC_INT16_IS_SUPPORTED must be defined" +#endif #ifndef Q_ATOMIC_INT32_IS_SUPPORTED # error "Q_ATOMIC_INT32_IS_SUPPORTED must be defined" #endif @@ -1671,22 +1684,19 @@ static_assert(sizeof(QAtomicInteger)); static_assert(sizeof(QAtomicInteger)); static_assert(sizeof(QAtomicInteger)); -#ifdef Q_ATOMIC_INT16_IS_SUPPORTED static_assert(sizeof(QAtomicInteger)); static_assert(sizeof(QAtomicInteger)); -# if WCHAR_MAX < 0x10000 static_assert(sizeof(QAtomicInteger)); -# endif static_assert(sizeof(QAtomicInteger)); -#endif + +static_assert(sizeof(QAtomicInteger)); +static_assert(sizeof(QAtomicInteger)); +static_assert(sizeof(QAtomicInteger)); +static_assert(sizeof(QAtomicInteger)); #ifdef Q_ATOMIC_INT64_IS_SUPPORTED static_assert(sizeof(QAtomicInteger)); static_assert(sizeof(QAtomicInteger)); #endif -#if WCHAR_MAX == INT_MAX -static_assert(sizeof(QAtomicInteger)); -#endif - QT_END_NAMESPACE -- cgit v1.2.3