Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:13

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___ATOMIC_ALIASES_H
0010 #define _LIBCPP___ATOMIC_ALIASES_H
0011 
0012 #include <__atomic/atomic.h>
0013 #include <__atomic/atomic_lock_free.h>
0014 #include <__atomic/contention_t.h>
0015 #include <__atomic/is_always_lock_free.h>
0016 #include <__config>
0017 #include <__cstddef/ptrdiff_t.h>
0018 #include <__cstddef/size_t.h>
0019 #include <__type_traits/conditional.h>
0020 #include <__type_traits/make_unsigned.h>
0021 #include <cstdint>
0022 
0023 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0024 #  pragma GCC system_header
0025 #endif
0026 
0027 _LIBCPP_BEGIN_NAMESPACE_STD
0028 
0029 using atomic_bool   = atomic<bool>;
0030 using atomic_char   = atomic<char>;
0031 using atomic_schar  = atomic<signed char>;
0032 using atomic_uchar  = atomic<unsigned char>;
0033 using atomic_short  = atomic<short>;
0034 using atomic_ushort = atomic<unsigned short>;
0035 using atomic_int    = atomic<int>;
0036 using atomic_uint   = atomic<unsigned int>;
0037 using atomic_long   = atomic<long>;
0038 using atomic_ulong  = atomic<unsigned long>;
0039 using atomic_llong  = atomic<long long>;
0040 using atomic_ullong = atomic<unsigned long long>;
0041 #if _LIBCPP_HAS_CHAR8_T
0042 using atomic_char8_t = atomic<char8_t>;
0043 #endif
0044 using atomic_char16_t = atomic<char16_t>;
0045 using atomic_char32_t = atomic<char32_t>;
0046 #if _LIBCPP_HAS_WIDE_CHARACTERS
0047 using atomic_wchar_t = atomic<wchar_t>;
0048 #endif
0049 
0050 using atomic_int_least8_t   = atomic<int_least8_t>;
0051 using atomic_uint_least8_t  = atomic<uint_least8_t>;
0052 using atomic_int_least16_t  = atomic<int_least16_t>;
0053 using atomic_uint_least16_t = atomic<uint_least16_t>;
0054 using atomic_int_least32_t  = atomic<int_least32_t>;
0055 using atomic_uint_least32_t = atomic<uint_least32_t>;
0056 using atomic_int_least64_t  = atomic<int_least64_t>;
0057 using atomic_uint_least64_t = atomic<uint_least64_t>;
0058 
0059 using atomic_int_fast8_t   = atomic<int_fast8_t>;
0060 using atomic_uint_fast8_t  = atomic<uint_fast8_t>;
0061 using atomic_int_fast16_t  = atomic<int_fast16_t>;
0062 using atomic_uint_fast16_t = atomic<uint_fast16_t>;
0063 using atomic_int_fast32_t  = atomic<int_fast32_t>;
0064 using atomic_uint_fast32_t = atomic<uint_fast32_t>;
0065 using atomic_int_fast64_t  = atomic<int_fast64_t>;
0066 using atomic_uint_fast64_t = atomic<uint_fast64_t>;
0067 
0068 using atomic_int8_t   = atomic< int8_t>;
0069 using atomic_uint8_t  = atomic<uint8_t>;
0070 using atomic_int16_t  = atomic< int16_t>;
0071 using atomic_uint16_t = atomic<uint16_t>;
0072 using atomic_int32_t  = atomic< int32_t>;
0073 using atomic_uint32_t = atomic<uint32_t>;
0074 using atomic_int64_t  = atomic< int64_t>;
0075 using atomic_uint64_t = atomic<uint64_t>;
0076 
0077 using atomic_intptr_t  = atomic<intptr_t>;
0078 using atomic_uintptr_t = atomic<uintptr_t>;
0079 using atomic_size_t    = atomic<size_t>;
0080 using atomic_ptrdiff_t = atomic<ptrdiff_t>;
0081 using atomic_intmax_t  = atomic<intmax_t>;
0082 using atomic_uintmax_t = atomic<uintmax_t>;
0083 
0084 // C++20 atomic_{signed,unsigned}_lock_free: prefer the contention type most highly, then the largest lock-free type
0085 #if _LIBCPP_STD_VER >= 20
0086 #  if ATOMIC_LLONG_LOCK_FREE == 2
0087 using __largest_lock_free_type _LIBCPP_NODEBUG = long long;
0088 #  elif ATOMIC_INT_LOCK_FREE == 2
0089 using __largest_lock_free_type _LIBCPP_NODEBUG = int;
0090 #  elif ATOMIC_SHORT_LOCK_FREE == 2
0091 using __largest_lock_free_type _LIBCPP_NODEBUG = short;
0092 #  elif ATOMIC_CHAR_LOCK_FREE == 2
0093 using __largest_lock_free_type _LIBCPP_NODEBUG = char;
0094 #  else
0095 #    define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen on unusual platforms)
0096 #  endif
0097 
0098 #  ifndef _LIBCPP_NO_LOCK_FREE_TYPES
0099 using __contention_t_or_largest _LIBCPP_NODEBUG =
0100     __conditional_t<__libcpp_is_always_lock_free<__cxx_contention_t>::__value,
0101                     __cxx_contention_t,
0102                     __largest_lock_free_type>;
0103 
0104 using atomic_signed_lock_free   = atomic<__contention_t_or_largest>;
0105 using atomic_unsigned_lock_free = atomic<make_unsigned_t<__contention_t_or_largest>>;
0106 #  endif // !_LIBCPP_NO_LOCK_FREE_TYPES
0107 #endif   // C++20
0108 
0109 _LIBCPP_END_NAMESPACE_STD
0110 
0111 #endif // _LIBCPP___ATOMIC_ALIASES_H