[libc++] decoupling Freestanding atomic<T> from libatomic.a

This patch introduces non-lockfree atomics that do not require using
an external libatomic. This work is done with the long-term goal of
allowing the use of <atomic> in freestanding environments.

Thanks to Olivier Giroux for the patch.
Differential Revision: https://reviews.llvm.org/D56913

llvm-svn: 355318
This commit is contained in:
Louis Dionne 2019-03-04 15:26:27 +00:00
parent 881e83d8b9
commit 21450545d1
2 changed files with 766 additions and 247 deletions

View File

@ -38,6 +38,10 @@
# define _LIBCPP_ABI_VERSION 1
#endif
#ifndef __STDC_HOSTED__
# define _LIBCPP_FREESTANDING
#endif
#ifndef _LIBCPP_STD_VER
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
@ -1220,9 +1224,18 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_HAS_GCC_ATOMIC_IMP
#endif
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
!defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
!defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
|| defined(_LIBCPP_HAS_NO_THREADS)
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
# define _LIBCPP_HAS_NO_ATOMIC_HEADER
#else
# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
# define _LIBCPP_ATOMIC_FLAG_TYPE bool
# endif
# ifdef _LIBCPP_FREESTANDING
# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
# endif
#endif
#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK

File diff suppressed because it is too large Load Diff