Back to home page

EIC code displayed by LXR

 
 

    


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

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