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
llvm-svn: 273076
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: df93bad1fe0abfa58a9ff4f2f490a39a9b95a315
diff --git a/src/memory.cpp b/src/memory.cpp
index 08f2259..15e947f 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -124,7 +124,7 @@
#endif // _LIBCPP_NO_RTTI
-#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
static const std::size_t __sp_mut_count = 16;
static __libcpp_mutex_t mut_back_imp[__sp_mut_count] =
@@ -177,7 +177,7 @@
return muts[hash<const void*>()(p) & (__sp_mut_count-1)];
}
-#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
void
declare_reachable(void*)