//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP___ATOMIC_ALIASES_H #define _LIBCPP___ATOMIC_ALIASES_H #include <__atomic/atomic.h> #include <__atomic/atomic_lock_free.h> #include <__atomic/contention_t.h> #include <__atomic/is_always_lock_free.h> #include <__config> #include <__type_traits/conditional.h> #include <__type_traits/make_unsigned.h> #include #include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD using atomic_bool = atomic; using atomic_char = atomic; using atomic_schar = atomic; using atomic_uchar = atomic; using atomic_short = atomic; using atomic_ushort = atomic; using atomic_int = atomic; using atomic_uint = atomic; using atomic_long = atomic; using atomic_ulong = atomic; using atomic_llong = atomic; using atomic_ullong = atomic; #ifndef _LIBCPP_HAS_NO_CHAR8_T using atomic_char8_t = atomic; #endif using atomic_char16_t = atomic; using atomic_char32_t = atomic; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS using atomic_wchar_t = atomic; #endif using atomic_int_least8_t = atomic; using atomic_uint_least8_t = atomic; using atomic_int_least16_t = atomic; using atomic_uint_least16_t = atomic; using atomic_int_least32_t = atomic; using atomic_uint_least32_t = atomic; using atomic_int_least64_t = atomic; using atomic_uint_least64_t = atomic; using atomic_int_fast8_t = atomic; using atomic_uint_fast8_t = atomic; using atomic_int_fast16_t = atomic; using atomic_uint_fast16_t = atomic; using atomic_int_fast32_t = atomic; using atomic_uint_fast32_t = atomic; using atomic_int_fast64_t = atomic; using atomic_uint_fast64_t = atomic; using atomic_int8_t = atomic< int8_t>; using atomic_uint8_t = atomic; using atomic_int16_t = atomic< int16_t>; using atomic_uint16_t = atomic; using atomic_int32_t = atomic< int32_t>; using atomic_uint32_t = atomic; using atomic_int64_t = atomic< int64_t>; using atomic_uint64_t = atomic; using atomic_intptr_t = atomic; using atomic_uintptr_t = atomic; using atomic_size_t = atomic; using atomic_ptrdiff_t = atomic; using atomic_intmax_t = atomic; using atomic_uintmax_t = atomic; // C++20 atomic_{signed,unsigned}_lock_free: prefer the contention type most highly, then the largest lock-free type #if _LIBCPP_STD_VER >= 20 # if ATOMIC_LLONG_LOCK_FREE == 2 using __largest_lock_free_type = long long; # elif ATOMIC_INT_LOCK_FREE == 2 using __largest_lock_free_type = int; # elif ATOMIC_SHORT_LOCK_FREE == 2 using __largest_lock_free_type = short; # elif ATOMIC_CHAR_LOCK_FREE == 2 using __largest_lock_free_type = char; # else # define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen in freestanding) # endif # ifndef _LIBCPP_NO_LOCK_FREE_TYPES using __contention_t_or_largest = __conditional_t<__libcpp_is_always_lock_free<__cxx_contention_t>::__value, __cxx_contention_t, __largest_lock_free_type>; using atomic_signed_lock_free = atomic<__contention_t_or_largest>; using atomic_unsigned_lock_free = atomic>; # endif // !_LIBCPP_NO_LOCK_FREE_TYPES #endif // C++20 _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___ATOMIC_ALIASES_H