summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-03-10 11:17:47 -0800
committerAapo Keskimolo <aapo.keskimolo@qt.io>2018-03-19 20:36:36 +0000
commit38597dd08083f1f5cbf947cd3b0290065f2872c6 (patch)
tree640841f198cd42f0a87d082360187010d24df20c
parent2417cade46d5680fe4a23ad2e3d1607b3989c758 (diff)
Atomic: silence MSVC warning in the generic fetchAndSub
MSVC atomics still use the generic version, instead of qatomic_cxx11.h. The implementation of fetchAndSub is implemented on top of fetchAndAdd, but produced a warning with unsigned types. Change-Id: I72f5230ad59948f784eafffd151aa53435b75298 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/thread/qgenericatomic.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h
index 5c4c02a2ec..89c4fe9a11 100644
--- a/src/corelib/thread/qgenericatomic.h
+++ b/src/corelib/thread/qgenericatomic.h
@@ -253,12 +253,15 @@ template <typename BaseClass> struct QGenericAtomicOps
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned
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);
}
+QT_WARNING_POP
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW