summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qbasicatomic.h
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2018-05-30 15:29:50 +0200
committerKai Koehne <kai.koehne@qt.io>2018-06-01 06:24:18 +0000
commit97c8b970cdeae405018fdaaee12bf4cea59fb23f (patch)
tree4802aa3d7015373dc7368587bb5a93d9b0f5d4f6 /src/corelib/thread/qbasicatomic.h
parent0a63d5fed6e020e81d3c570d299d1292c33fa284 (diff)
Revert "Atomics: remove qatomic_msvc.h"
This reverts commit 90493e16b8dd9edc6176d0abc255422edbbb05c3. The change broke static builds with MSVC. [ChangeLog][Visual Studio] Reverted a change that caused static binaries compiled with Visual Studio 2015 to crash on start-up. Note that this does not apply to Visual Studio 2017 static binaries, even though the crash stack traces are very similar: with 2017, the problem is compiler regression and requires updating to version 15.8 for the fix. Task-number: QTBUG-68514 Change-Id: I67ea8e1ef442cecab83e7d8d74efc9617e02da35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qbasicatomic.h')
-rw-r--r--src/corelib/thread/qbasicatomic.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index aacd12f2208..a0304697b88 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -45,8 +45,20 @@
#if defined(QT_BOOTSTRAPPED)
# include <QtCore/qatomic_bootstrap.h>
-#else
+
+// If C++11 atomics are supported, use them!
+// Note that constexpr support is sometimes disabled in QNX builds but its
+// library has <atomic>.
+#elif defined(Q_COMPILER_ATOMICS) && (defined(Q_COMPILER_CONSTEXPR) || defined(Q_OS_QNX))
# include <QtCore/qatomic_cxx11.h>
+
+// We only support one fallback: MSVC, because even on version 2015, it lacks full constexpr support
+#elif defined(Q_CC_MSVC)
+# include <QtCore/qatomic_msvc.h>
+
+// No fallback
+#else
+# error "Qt requires C++11 support"
#endif
QT_WARNING_PUSH