From 1e9db9f5e18123f2e686c10b39b586caf1307729 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Wed, 29 Oct 2014 16:43:54 -0700
Subject: [PATCH] Enable C++11 atomics with Clang

I don't know why it was an #if 0. The __has_feature has been there for a
while. But, just to be sure, we check the presence of the header too.

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

diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index d7d56995914..949617fa7c0 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -581,7 +581,7 @@
 #      define Q_COMPILER_ALIGNAS
 #      define Q_COMPILER_ALIGNOF
 #    endif
-#    if 0 /* not implemented in clang yet */
+#    if __has_feature(cxx_atomic) && __has_include(<atomic>)
 #     define Q_COMPILER_ATOMICS
 #    endif
 #    if __has_feature(cxx_attributes)
@@ -880,6 +880,8 @@
 #  undef Q_COMPILER_INITIALIZER_LISTS
 #  undef Q_COMPILER_RVALUE_REFS
 #  undef Q_COMPILER_REF_QUALIFIERS
+// Also disable <atomic>, since it's clearly not there
+#  undef Q_COMPILER_ATOMICS
 # endif
 # if defined(_LIBCPP_VERSION)
 // libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
-- 
GitLab