From 670cb2edbcdc13b33cebe45a682a6dc10f17b616 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 27 Jul 2015 10:46:06 +0200 Subject: Move Q_ALWAYS_INLINE next to Q_NEVER_INLINE in qglobal.h. Change-Id: I7e3b7ecca6b5f142fa6cb5db2e9521ed3212afe8 Reviewed-by: Lars Knoll --- src/corelib/thread/qgenericatomic.h | 81 +++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 45 deletions(-) (limited to 'src/corelib/thread/qgenericatomic.h') diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h index a9a790c14c..d3e7d51efd 100644 --- a/src/corelib/thread/qgenericatomic.h +++ b/src/corelib/thread/qgenericatomic.h @@ -46,13 +46,6 @@ QT_END_NAMESPACE #pragma qt_sync_stop_processing #endif -#ifdef Q_CC_GNU -// lowercase is fine, we'll undef it below -#define always_inline __attribute__((always_inline, gnu_inline)) -#else -#define always_inline -#endif - template struct QAtomicOpsSupport { enum { IsSupported = 0 }; }; template<> struct QAtomicOpsSupport<4> { enum { IsSupported = 1 }; }; @@ -84,19 +77,19 @@ template struct QGenericAtomicOps { } - template static inline always_inline + template static Q_ALWAYS_INLINE T load(const T &_q_value) Q_DECL_NOTHROW { return _q_value; } - template static inline always_inline + template static Q_ALWAYS_INLINE void store(T &_q_value, X newValue) Q_DECL_NOTHROW { _q_value = newValue; } - template static inline always_inline + template static Q_ALWAYS_INLINE T loadAcquire(const T &_q_value) Q_DECL_NOTHROW { T tmp = *static_cast(&_q_value); @@ -104,7 +97,7 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE void storeRelease(T &_q_value, X newValue) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); @@ -115,13 +108,13 @@ template struct QGenericAtomicOps { return BaseClass::isFetchAndAddNative(); } static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return BaseClass::isFetchAndAddWaitFree(); } - template static inline always_inline + template static Q_ALWAYS_INLINE bool ref(T &_q_value) Q_DECL_NOTHROW { return BaseClass::fetchAndAddRelaxed(_q_value, 1) != T(-1); } - template static inline always_inline + template static Q_ALWAYS_INLINE bool deref(T &_q_value) Q_DECL_NOTHROW { return BaseClass::fetchAndAddRelaxed(_q_value, -1) != 1; @@ -138,7 +131,7 @@ template struct QGenericAtomicOps bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW; #endif - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW { bool tmp = BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue); @@ -146,21 +139,21 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetRelease(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue); } - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue); } - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetAcquire(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW { bool tmp = BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue); @@ -168,14 +161,14 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetRelease(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::testAndSetRelaxed(_q_value, expectedValue, newValue, currentValue); } - template static inline always_inline + template static Q_ALWAYS_INLINE bool testAndSetOrdered(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); @@ -185,7 +178,7 @@ template struct QGenericAtomicOps static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return false; } static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return false; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndStoreRelaxed(T &_q_value, X newValue) Q_DECL_NOTHROW { // implement fetchAndStore on top of testAndSet @@ -196,7 +189,7 @@ template struct QGenericAtomicOps } } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndStoreAcquire(T &_q_value, X newValue) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndStoreRelaxed(_q_value, newValue); @@ -204,14 +197,14 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndStoreRelease(T &_q_value, X newValue) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndStoreRelaxed(_q_value, newValue); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndStoreOrdered(T &_q_value, X newValue) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); @@ -220,7 +213,7 @@ template struct QGenericAtomicOps static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return false; } static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return false; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement fetchAndAdd on top of testAndSet @@ -231,7 +224,7 @@ template struct QGenericAtomicOps } } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd); @@ -239,28 +232,28 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAddRelease(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAddOrdered(T &_q_value, typename QAtomicAdditiveType::AdditiveT valueToAdd) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT operand) Q_DECL_NOTHROW { // implement fetchAndSub on top of fetchAndAdd return fetchAndAddRelaxed(_q_value, -operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType::AdditiveT operand) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndSubRelaxed(_q_value, operand); @@ -268,21 +261,21 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndSubRelease(T &_q_value, typename QAtomicAdditiveType::AdditiveT operand) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndSubRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndSubOrdered(T &_q_value, typename QAtomicAdditiveType::AdditiveT operand) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); return BaseClass::fetchAndSubRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAndRelaxed(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { // implement fetchAndAnd on top of testAndSet @@ -293,7 +286,7 @@ template struct QGenericAtomicOps } } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAndAcquire(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndAndRelaxed(_q_value, operand); @@ -301,21 +294,21 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAndRelease(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndAndRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndAndOrdered(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); return BaseClass::fetchAndAndRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndOrRelaxed(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { // implement fetchAndOr on top of testAndSet @@ -326,7 +319,7 @@ template struct QGenericAtomicOps } } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndOrAcquire(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndOrRelaxed(_q_value, operand); @@ -334,21 +327,21 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndOrRelease(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndOrRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndOrOrdered(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); return BaseClass::fetchAndOrRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndXorRelaxed(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { // implement fetchAndXor on top of testAndSet @@ -359,7 +352,7 @@ template struct QGenericAtomicOps } } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndXorAcquire(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { T tmp = BaseClass::fetchAndXorRelaxed(_q_value, operand); @@ -367,14 +360,14 @@ template struct QGenericAtomicOps return tmp; } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndXorRelease(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::releaseMemoryFence(_q_value); return BaseClass::fetchAndXorRelaxed(_q_value, operand); } - template static inline always_inline + template static Q_ALWAYS_INLINE T fetchAndXorOrdered(T &_q_value, typename QtPrivate::QEnableIf::isIntegral, T>::Type operand) Q_DECL_NOTHROW { BaseClass::orderedMemoryFence(_q_value); @@ -382,7 +375,5 @@ template struct QGenericAtomicOps } }; -#undef always_inline - QT_END_NAMESPACE #endif // QGENERICATOMIC_H -- cgit v1.2.3