From b3c7395a233763b85e968608755042491745f657 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 17 Apr 2014 10:39:02 +0200 Subject: [PATCH] Atomic: support clang 3.4+ --- Source/Core/Common/Atomic_GCC.h | 3 ++- Source/Core/Common/Common.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Atomic_GCC.h b/Source/Core/Common/Atomic_GCC.h index f06628037f..f4ffb0f631 100644 --- a/Source/Core/Common/Atomic_GCC.h +++ b/Source/Core/Common/Atomic_GCC.h @@ -45,7 +45,8 @@ inline void AtomicOr(volatile u32& target, u32 value) { __sync_or_and_fetch(&target, value); } -#ifdef __clang__ +// Support clang versions older than 3.4. +#if __clang__ && !__has_feature(cxx_atomic) template _Atomic(T)* ToC11Atomic(volatile T* loc) { diff --git a/Source/Core/Common/Common.h b/Source/Core/Common/Common.h index 1f600926ff..8605d97929 100644 --- a/Source/Core/Common/Common.h +++ b/Source/Core/Common/Common.h @@ -11,6 +11,10 @@ #include #include +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + // SVN version number extern const char *scm_desc_str; extern const char *scm_branch_str;