Move Q_ALWAYS_INLINE next to Q_NEVER_INLINE in qglobal.h.
Change-Id: I7e3b7ecca6b5f142fa6cb5db2e9521ed3212afe8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
70da0b71fb
commit
670cb2edbc
@ -496,10 +496,13 @@ typedef qptrdiff qintptr;
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
# define Q_NEVER_INLINE __declspec(noinline)
|
||||
# define Q_ALWAYS_INLINE __forceinline
|
||||
#elif defined(Q_CC_GNU)
|
||||
# define Q_NEVER_INLINE __attribute__((noinline))
|
||||
# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
# define Q_NEVER_INLINE
|
||||
# define Q_ALWAYS_INLINE inline
|
||||
#endif
|
||||
|
||||
//defines the type for the WNDPROC on windows
|
||||
|
@ -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<int> struct QAtomicOpsSupport { enum { IsSupported = 0 }; };
|
||||
template<> struct QAtomicOpsSupport<4> { enum { IsSupported = 1 }; };
|
||||
|
||||
@ -84,19 +77,19 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T load(const T &_q_value) Q_DECL_NOTHROW
|
||||
{
|
||||
return _q_value;
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> static Q_ALWAYS_INLINE
|
||||
void store(T &_q_value, X newValue) Q_DECL_NOTHROW
|
||||
{
|
||||
_q_value = newValue;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T loadAcquire(const T &_q_value) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = *static_cast<const volatile T *>(&_q_value);
|
||||
@ -104,7 +97,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> static Q_ALWAYS_INLINE
|
||||
void storeRelease(T &_q_value, X newValue) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
@ -115,13 +108,13 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
{ return BaseClass::isFetchAndAddNative(); }
|
||||
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW
|
||||
{ return BaseClass::isFetchAndAddWaitFree(); }
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
bool ref(T &_q_value) Q_DECL_NOTHROW
|
||||
{
|
||||
return BaseClass::fetchAndAddRelaxed(_q_value, 1) != T(-1);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
bool deref(T &_q_value) Q_DECL_NOTHROW
|
||||
{
|
||||
return BaseClass::fetchAndAddRelaxed(_q_value, -1) != 1;
|
||||
@ -138,7 +131,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
bool testAndSetRelaxed(T &_q_value, X expectedValue, X newValue, X *currentValue) Q_DECL_NOTHROW;
|
||||
#endif
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename BaseClass> 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 <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> 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 <typename T, typename X> static inline always_inline
|
||||
template <typename T, typename X> static Q_ALWAYS_INLINE
|
||||
T fetchAndStoreOrdered(T &_q_value, X newValue) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
@ -220,7 +213,7 @@ template <typename BaseClass> 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 <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndAdd on top of testAndSet
|
||||
@ -231,7 +224,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
|
||||
@ -239,28 +232,28 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAddRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAddOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndSub on top of fetchAndAdd
|
||||
return fetchAndAddRelaxed(_q_value, -operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndSubRelaxed(_q_value, operand);
|
||||
@ -268,21 +261,21 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndSubRelease(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndSubRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndSubOrdered(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndSubRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndAnd on top of testAndSet
|
||||
@ -293,7 +286,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
@ -301,21 +294,21 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndOr on top of testAndSet
|
||||
@ -326,7 +319,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
@ -334,21 +327,21 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndXor on top of testAndSet
|
||||
@ -359,7 +352,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndXorRelaxed(_q_value, operand);
|
||||
@ -367,14 +360,14 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndXorRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static inline always_inline
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
@ -382,7 +375,5 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
};
|
||||
|
||||
#undef always_inline
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QGENERICATOMIC_H
|
||||
|
@ -62,15 +62,12 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_CC_GNU)
|
||||
# define Q_STATIC_TEMPLATE_FUNCTION static
|
||||
# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
# define Q_DECL_RESTRICT __restrict__
|
||||
#elif defined(Q_CC_MSVC)
|
||||
# define Q_STATIC_TEMPLATE_FUNCTION static
|
||||
# define Q_ALWAYS_INLINE __forceinline
|
||||
# define Q_DECL_RESTRICT __restrict
|
||||
#else
|
||||
# define Q_STATIC_TEMPLATE_FUNCTION static
|
||||
# define Q_ALWAYS_INLINE inline
|
||||
# define Q_DECL_RESTRICT
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user