From 2b00f97ab05f144293b26d1e0d8cf4c54d222f92 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 6 Aug 2012 18:03:49 +0200 Subject: Add Q_DECL_CONSTEXPR to the isXXX functions in the new atomics. This allows one to write code that depends on these values at compile-time. Change-Id: I7d78524ed9c70d4141360496d1d764dcbfa92e62 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/thread/qbasicatomic.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/corelib/thread/qbasicatomic.h') diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 3c8615decb..8aec250f90 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -137,14 +137,14 @@ public: T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); } - static bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); } - static bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return Ops::isReferenceCountingWaitFree(); } + static Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return Ops::isReferenceCountingNative(); } + static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return Ops::isReferenceCountingWaitFree(); } bool ref() Q_DECL_NOTHROW { return Ops::ref(_q_value); } bool deref() Q_DECL_NOTHROW { return Ops::deref(_q_value); } - static bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); } - static bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); } + static Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); } + static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); } bool testAndSetRelaxed(T expectedValue, T newValue) Q_DECL_NOTHROW { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); } @@ -155,8 +155,8 @@ public: bool testAndSetOrdered(T expectedValue, T newValue) Q_DECL_NOTHROW { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); } - static bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); } - static bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); } + static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); } + static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); } T fetchAndStoreRelaxed(T newValue) Q_DECL_NOTHROW { return Ops::fetchAndStoreRelaxed(_q_value, newValue); } @@ -167,8 +167,8 @@ public: T fetchAndStoreOrdered(T newValue) Q_DECL_NOTHROW { return Ops::fetchAndStoreOrdered(_q_value, newValue); } - static bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); } - static bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); } + static Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); } + static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); } T fetchAndAddRelaxed(T valueToAdd) Q_DECL_NOTHROW { return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); } @@ -207,8 +207,8 @@ public: Type loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } void storeRelease(Type newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); } - static bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); } - static bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); } + static Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return Ops::isTestAndSetNative(); } + static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return Ops::isTestAndSetWaitFree(); } bool testAndSetRelaxed(Type expectedValue, Type newValue) Q_DECL_NOTHROW { return Ops::testAndSetRelaxed(_q_value, expectedValue, newValue); } @@ -219,8 +219,8 @@ public: bool testAndSetOrdered(Type expectedValue, Type newValue) Q_DECL_NOTHROW { return Ops::testAndSetOrdered(_q_value, expectedValue, newValue); } - static bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); } - static bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); } + static Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return Ops::isFetchAndStoreNative(); } + static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndStoreWaitFree(); } Type fetchAndStoreRelaxed(Type newValue) Q_DECL_NOTHROW { return Ops::fetchAndStoreRelaxed(_q_value, newValue); } @@ -231,8 +231,8 @@ public: Type fetchAndStoreOrdered(Type newValue) Q_DECL_NOTHROW { return Ops::fetchAndStoreOrdered(_q_value, newValue); } - static bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); } - static bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); } + static Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return Ops::isFetchAndAddNative(); } + static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return Ops::isFetchAndAddWaitFree(); } Type fetchAndAddRelaxed(qptrdiff valueToAdd) Q_DECL_NOTHROW { return Ops::fetchAndAddRelaxed(_q_value, valueToAdd); } -- cgit v1.2.3