diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-08-06 17:48:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-09 03:26:24 +0200 |
commit | 6bf4e448fee554153eab09c755ba6fdca012bd52 (patch) | |
tree | 0efb1e49ef18b1e80d3bf8bb6569d4a284674a3c /src/corelib/arch/qatomic_gcc.h | |
parent | 2d9c2c0562aa895b46a7c01902660aa51981e989 (diff) |
Mark all atomic functions as Q_DECL_NOTHROW
Actually, only the "new" atomics are marked. The old implementation,
based on qoldbasicatomic.h is unchanged, but should still work without a
problem.
The following configurations were tested and do work:
- x86 64-bit
- x86 32-bit
- generic GCC
- generic C++11 std::atomic
- bootstrap
- ARMv6 and 7
- MIPS
- MSVC 2010 32-bit
- MSVC 2010 64-bit
The only two configurations untested are IA-64 and ARMv5. Except for
MSVC, all configurations were tested with GCC 4.6 (MIPS and ARM) and 4.7
(x86 and generics).
Change-Id: Iecbfeacd9d20b535453e91335165e9a221e0b47e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/arch/qatomic_gcc.h')
-rw-r--r-- | src/corelib/arch/qatomic_gcc.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/arch/qatomic_gcc.h b/src/corelib/arch/qatomic_gcc.h index 9edb74fa73..73df3e785e 100644 --- a/src/corelib/arch/qatomic_gcc.h +++ b/src/corelib/arch/qatomic_gcc.h @@ -84,45 +84,45 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> > typedef T Type; #ifndef __ia64__ - static T loadAcquire(const T &_q_value) + static T loadAcquire(const T &_q_value) Q_DECL_NOTHROW { T tmp = _q_value; __sync_synchronize(); return tmp; } - static void storeRelease(T &_q_value, T newValue) + static void storeRelease(T &_q_value, T newValue) Q_DECL_NOTHROW { __sync_synchronize(); _q_value = newValue; } #endif - static bool isTestAndSetNative() { return false; } - static bool isTestAndSetWaitFree() { return false; } - static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) + static bool isTestAndSetNative() Q_DECL_NOTHROW { return false; } + static bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; } + static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { return __sync_bool_compare_and_swap(&_q_value, expectedValue, newValue); } - static T fetchAndStoreRelaxed(T &_q_value, T newValue) + static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { return __sync_lock_test_and_set(&_q_value, newValue); } - static T fetchAndStoreRelease(T &_q_value, T newValue) + static T fetchAndStoreRelease(T &_q_value, T newValue) Q_DECL_NOTHROW { __sync_synchronize(); return __sync_lock_test_and_set(&_q_value, newValue); } - static T fetchAndStoreOrdered(T &_q_value, T newValue) + static T fetchAndStoreOrdered(T &_q_value, T newValue) Q_DECL_NOTHROW { return fetchAndStoreRelease(_q_value, newValue); } static - T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) + T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { return __sync_fetch_and_add(&_q_value, valueToAdd * QAtomicAdditiveType<T>::AddScale); } |