10#ifndef __CLANG_STDATOMIC_H
11#define __CLANG_STDATOMIC_H
21#if __STDC_HOSTED__ && \
22 __has_include_next(<stdatomic.h>) && \
23 (!defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 202002L))
24# include_next <stdatomic.h>
36#define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
37#define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
38#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
39#define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
41#define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
42#define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
43#define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
44#define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
45#define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
46#define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
47#define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
48#define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
51#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202311L) || \
54#define ATOMIC_VAR_INIT(value) (value)
57#if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L && \
58 __STDC_VERSION__ < 202311L) || \
59 (defined(__cplusplus) && __cplusplus >= 202002L)) && \
60 !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
62#pragma clang deprecated(ATOMIC_VAR_INIT)
64#define atomic_init __c11_atomic_init
77#define kill_dependency(y) (y)
85#define atomic_thread_fence(order) __c11_atomic_thread_fence(order)
86#define atomic_signal_fence(order) __c11_atomic_signal_fence(order)
90#define atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
95typedef _Atomic(
bool) atomic_bool;
109typedef _Atomic(
unsigned long long) atomic_ullong;
110#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
111typedef _Atomic(
unsigned char) atomic_char8_t;
113typedef _Atomic(uint_least16_t) atomic_char16_t;
114typedef _Atomic(uint_least32_t) atomic_char32_t;
116typedef _Atomic(int_least8_t) atomic_int_least8_t;
117typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
118typedef _Atomic(int_least16_t) atomic_int_least16_t;
119typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
120typedef _Atomic(int_least32_t) atomic_int_least32_t;
121typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
122typedef _Atomic(int_least64_t) atomic_int_least64_t;
123typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
124typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
125typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
126typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
127typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
128typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
129typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
130typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
131typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
141#define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST)
142#define atomic_store_explicit __c11_atomic_store
144#define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST)
145#define atomic_load_explicit __c11_atomic_load
147#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
148#define atomic_exchange_explicit __c11_atomic_exchange
150#define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
151#define atomic_compare_exchange_strong_explicit __c11_atomic_compare_exchange_strong
153#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
154#define atomic_compare_exchange_weak_explicit __c11_atomic_compare_exchange_weak
156#define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
157#define atomic_fetch_add_explicit __c11_atomic_fetch_add
159#define atomic_fetch_sub(object, operand) __c11_atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
160#define atomic_fetch_sub_explicit __c11_atomic_fetch_sub
162#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
163#define atomic_fetch_or_explicit __c11_atomic_fetch_or
165#define atomic_fetch_xor(object, operand) __c11_atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
166#define atomic_fetch_xor_explicit __c11_atomic_fetch_xor
168#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
169#define atomic_fetch_and_explicit __c11_atomic_fetch_and
176#define ATOMIC_FLAG_INIT {false}
178#define ATOMIC_FLAG_INIT { 0 }
192#define atomic_flag_test_and_set(object) __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST)
193#define atomic_flag_test_and_set_explicit(object, order) __c11_atomic_exchange(&(object)->_Value, 1, order)
195#define atomic_flag_clear(object) __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST)
196#define atomic_flag_clear_explicit(object, order) __c11_atomic_store(&(object)->_Value, 0, order)
__PTRDIFF_TYPE__ ptrdiff_t
__INTPTR_TYPE__ intptr_t
A signed integer type with the property that any valid pointer to void can be converted to this type,...
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
#define atomic_flag_clear(object)
#define atomic_signal_fence(order)
#define atomic_thread_fence(order)
#define atomic_flag_test_and_set_explicit(object, order)
#define atomic_flag_test_and_set(object)
#define atomic_flag_clear_explicit(object, order)
typedef _Atomic(_Bool) atomic_bool
__UINTMAX_TYPE__ uintmax_t