From 1b961e8b5d508d054e31c0050f27891606714393 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Wed, 29 Oct 2014 14:23:19 -0700
Subject: [PATCH] Fix compilation of <atomic> with ICC and libc++

The libc++ header does this:

 #if !__has_feature(cxx_atomic)
 #error <atomic> is not implemented

So we can't enable the feature until the compiler reports true for that
test.

Change-Id: I96f1c7eea8b93d93bd721fe5a85fa987339d091f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
---
 src/corelib/global/qcompilerdetection.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 8e52c503229..d7d56995914 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -881,6 +881,13 @@
 #  undef Q_COMPILER_RVALUE_REFS
 #  undef Q_COMPILER_REF_QUALIFIERS
 # endif
+# if defined(_LIBCPP_VERSION)
+// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
+// doesn't support it. That's required for the Intel compiler on OS X, for example.
+#  if !__has_feature(cxx_atomic)
+#   undef Q_COMPILER_ATOMICS
+#  endif
+# endif
 # if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
 // Mac OS X: Apple's low-level implementation of the C++ support library
 // (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The
-- 
GitLab