summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-04-24 14:45:36 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-10 03:45:35 +0200
commit7ebf21e004094485aea025f877f077c161c76f1b (patch)
treee9fe75b078a8c891818866281cd5adec873e1c17 /src/corelib/global
parentea461b7800a5d33e570329bedd9d9340d4577df5 (diff)
Defer enabling std::atomic on GCC until GCC 4.7
The implementation that GCC came with from 4.4 to 4.6 used external locks for most platforms, other than x86. It's unsuitable to be called "atomic" at all. More importantly, it's not behaviour-compatible with Qt's own QBasicAtomic classes. Change-Id: I92a0beab58504e6bd7cd236d358fef905c69821c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 9b609f76d0..548eebd3ad 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -618,7 +618,6 @@
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++11 features supported in GCC 4.4: */
-# define Q_COMPILER_ATOMICS
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_CLASS_ENUM
@@ -642,6 +641,11 @@
# define Q_COMPILER_RANGE_FOR
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
+ /* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
+ * However, the implementation is incomplete for most platforms until GCC 4.7:
+ * instead, std::atomic would use an external lock. Since we need an std::atomic
+ * that is behavior-compatible with QBasicAtomic, we only enable it here */
+# define Q_COMPILER_ATOMICS
/* GCC 4.6.x has problems dealing with noexcept expressions,
* so turn the feature on for 4.7 and above, only */
# define Q_COMPILER_NOEXCEPT