summaryrefslogtreecommitdiffstats
path: root/src/corelib/arch/qatomic_msvc.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-08-06 17:48:42 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-09 03:26:24 +0200
commit6bf4e448fee554153eab09c755ba6fdca012bd52 (patch)
tree0efb1e49ef18b1e80d3bf8bb6569d4a284674a3c /src/corelib/arch/qatomic_msvc.h
parent2d9c2c0562aa895b46a7c01902660aa51981e989 (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_msvc.h')
-rw-r--r--src/corelib/arch/qatomic_msvc.h66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h
index 3e0923b0be..a7de122a3e 100644
--- a/src/corelib/arch/qatomic_msvc.h
+++ b/src/corelib/arch/qatomic_msvc.h
@@ -276,49 +276,49 @@ struct QAtomicOpsBySize<4> : QGenericAtomicOps<QAtomicOpsBySize<4> >
// The 32-bit Interlocked*() API takes parameters as longs.
typedef long Type;
- static inline bool isReferenceCountingNative() { return true; }
- static inline bool isReferenceCountingWaitFree() { return true; }
- static bool ref(long &_q_value);
- static bool deref(long &_q_value);
-
- static inline bool isTestAndSetNative() { return true; }
- static inline bool isTestAndSetWaitFree() { return true; }
- static bool testAndSetRelaxed(long &_q_value, long expectedValue, long newValue);
-
- static inline bool isFetchAndStoreNative() { return true; }
- static inline bool isFetchAndStoreWaitFree() { return true; }
- static long fetchAndStoreRelaxed(long &_q_value, long newValue);
-
- static inline bool isFetchAndAddNative() { return true; }
- static inline bool isFetchAndAddWaitFree() { return true; }
- static long fetchAndAddRelaxed(long &_q_value, QAtomicAdditiveType<long>::AdditiveT valueToAdd);
+ static inline bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return true; }
+ static bool ref(long &_q_value) Q_DECL_NOTHROW;
+ static bool deref(long &_q_value) Q_DECL_NOTHROW;
+
+ static inline bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
+ static bool testAndSetRelaxed(long &_q_value, long expectedValue, long newValue) Q_DECL_NOTHROW;
+
+ static inline bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
+ static long fetchAndStoreRelaxed(long &_q_value, long newValue) Q_DECL_NOTHROW;
+
+ static inline bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
+ static long fetchAndAddRelaxed(long &_q_value, QAtomicAdditiveType<long>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
};
template <typename T>
struct QAtomicOps : QAtomicOpsBySize<sizeof(T)>
{ };
-inline bool QAtomicOpsBySize<4>::ref(long &_q_value)
+inline bool QAtomicOpsBySize<4>::ref(long &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_INCREMENT(&_q_value) != 0;
}
-inline bool QAtomicOpsBySize<4>::deref(long &_q_value)
+inline bool QAtomicOpsBySize<4>::deref(long &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_DECREMENT(&_q_value) != 0;
}
-inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(long &_q_value, long expectedValue, long newValue)
+inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(long &_q_value, long expectedValue, long newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_COMPARE_EXCHANGE(&_q_value, newValue, expectedValue) == expectedValue;
}
-inline long QAtomicOpsBySize<4>::fetchAndStoreRelaxed(long &_q_value, long newValue)
+inline long QAtomicOpsBySize<4>::fetchAndStoreRelaxed(long &_q_value, long newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_EXCHANGE(&_q_value, newValue);
}
-inline long QAtomicOpsBySize<4>::fetchAndAddRelaxed(long &_q_value, QAtomicAdditiveType<long>::AdditiveT valueToAdd)
+inline long QAtomicOpsBySize<4>::fetchAndAddRelaxed(long &_q_value, QAtomicAdditiveType<long>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_EXCHANGE_ADD(&_q_value, valueToAdd * QAtomicAdditiveType<long>::AddScale);
}
@@ -329,33 +329,33 @@ struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
{
typedef T *Type;
- static inline bool isTestAndSetNative() { return true; }
- static inline bool isTestAndSetWaitFree() { return true; }
- static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue);
+ static inline bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
+ static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW;
- static inline bool isFetchAndStoreNative() { return true; }
- static inline bool isFetchAndStoreWaitFree() { return true; }
- static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue);
+ static inline bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
+ static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW;
- static inline bool isFetchAndAddNative() { return true; }
- static inline bool isFetchAndAddWaitFree() { return true; }
- static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd);
+ static inline bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
+ static inline bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
+ static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW;
};
template <typename T>
-inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue)
+inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue) == expectedValue;
}
template <typename T>
-inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue)
+inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
}
template <typename T>
-inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd)
+inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T)));
}