summaryrefslogtreecommitdiff
path: root/include/memory
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-06-18 02:12:53 +0000
committerEric Fiselier <eric@efcs.ca>2016-06-18 02:12:53 +0000
commitba9dccd902a8276e17a066e9e635fb2cc9a34d1f (patch)
tree09e3ef45a7f51d69f3d4d1e63935aeed9986453a /include/memory
parent591e18f6aaa7f8a8ae1ed0e239708b5e752173bd (diff)
Enable building and using atomic shared_ptr for GCC.
Summary: Currently the implementation of [util.smartptr.shared.atomic] is provided only when using Clang, and not with GCC. This is a relic of not having a GCC implementation of <atomic>, even though <atomic> isn't actually used in the implementation. This patch enables support for atomic shared_ptr functions when using GCC. Note that this is not a header only change. Previously only Clang builds of libc++.so would provide the required symbols. There is no reason for this restriction. After this change both Clang and GCC builds should be binary compatible with each other WRT these symbols. Reviewers: mclow.lists, rmaprath, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21407 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/memory')
-rw-r--r--include/memory7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/memory b/include/memory
index 8324d1c5f..587d3059e 100644
--- a/include/memory
+++ b/include/memory
@@ -5464,9 +5464,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
-// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
-// enabled with clang.
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
class _LIBCPP_TYPE_VIS __sp_mut
{
@@ -5595,7 +5594,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
return atomic_compare_exchange_weak(__p, __v, __w);
}
-#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
//enum class
struct _LIBCPP_TYPE_VIS pointer_safety