chromium/third_party/llvm-build/Release+Asserts/lib/clang/20/include/stdatomic.h

/*===---- stdatomic.h - Standard header for atomic types and operations -----===
 *
 * 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 __CLANG_STDATOMIC_H
#define __CLANG_STDATOMIC_H

/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
 * example, already has a Clang-compatible stdatomic.h header.
 *
 * Exclude the MSVC path as well as the MSVC header as of the 14.31.30818
 * explicitly disallows `stdatomic.h` in the C mode via an `#error`.  Fallback
 * to the clang resource header until that is fully supported.  The
 * `stdatomic.h` header requires C++23 or newer.
 */
#if __STDC_HOSTED__ &&                                                         \
    __has_include_next(<stdatomic.h>) &&                                       \
    (!defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 202002L))
# include_next <stdatomic.h>
#else

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/* 7.17.1 Introduction */

#define ATOMIC_BOOL_LOCK_FREE
#define ATOMIC_CHAR_LOCK_FREE
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
#define ATOMIC_CHAR8_T_LOCK_FREE
#endif
#define ATOMIC_CHAR16_T_LOCK_FREE
#define ATOMIC_CHAR32_T_LOCK_FREE
#define ATOMIC_WCHAR_T_LOCK_FREE
#define ATOMIC_SHORT_LOCK_FREE
#define ATOMIC_INT_LOCK_FREE
#define ATOMIC_LONG_LOCK_FREE
#define ATOMIC_LLONG_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE

/* 7.17.2 Initialization */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202311L) ||               \
    defined(__cplusplus)
/* ATOMIC_VAR_INIT was removed in C23, but still remains in C++23. */
#define ATOMIC_VAR_INIT(value)
#endif

#if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L &&              \
      __STDC_VERSION__ < 202311L) ||                                           \
     (defined(__cplusplus) && __cplusplus >= 202002L)) &&                      \
    !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
/* ATOMIC_VAR_INIT was deprecated in C17 and C++20. */
#pragma clang deprecated(ATOMIC_VAR_INIT)
#endif
#define atomic_init

/* 7.17.3 Order and consistency */

memory_order;

#define kill_dependency(y)

/* 7.17.4 Fences */

/* These should be provided by the libc implementation. */
void atomic_thread_fence(memory_order);
void atomic_signal_fence(memory_order);

#define atomic_thread_fence(order)
#define atomic_signal_fence(order)

/* 7.17.5 Lock-free property */

#define atomic_is_lock_free(obj)

/* 7.17.6 Atomic integer types */

#ifdef __cplusplus
typedef _Atomic(bool)               atomic_bool;
#else
atomic_bool;
#endif
atomic_char;
atomic_schar;
atomic_uchar;
atomic_short;
atomic_ushort;
atomic_int;
atomic_uint;
atomic_long;
atomic_ulong;
atomic_llong;
atomic_ullong;
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
typedef _Atomic(unsigned char)      atomic_char8_t;
#endif
atomic_char16_t;
atomic_char32_t;
atomic_wchar_t;
atomic_int_least8_t;
atomic_uint_least8_t;
atomic_int_least16_t;
atomic_uint_least16_t;
atomic_int_least32_t;
atomic_uint_least32_t;
atomic_int_least64_t;
atomic_uint_least64_t;
atomic_int_fast8_t;
atomic_uint_fast8_t;
atomic_int_fast16_t;
atomic_uint_fast16_t;
atomic_int_fast32_t;
atomic_uint_fast32_t;
atomic_int_fast64_t;
atomic_uint_fast64_t;
atomic_intptr_t;
atomic_uintptr_t;
atomic_size_t;
atomic_ptrdiff_t;
atomic_intmax_t;
atomic_uintmax_t;

/* 7.17.7 Operations on atomic types */

#define atomic_store(object, desired)
#define atomic_store_explicit

#define atomic_load(object)
#define atomic_load_explicit

#define atomic_exchange(object, desired)
#define atomic_exchange_explicit

#define atomic_compare_exchange_strong(object, expected, desired)
#define atomic_compare_exchange_strong_explicit

#define atomic_compare_exchange_weak(object, expected, desired)
#define atomic_compare_exchange_weak_explicit

#define atomic_fetch_add(object, operand)
#define atomic_fetch_add_explicit

#define atomic_fetch_sub(object, operand)
#define atomic_fetch_sub_explicit

#define atomic_fetch_or(object, operand)
#define atomic_fetch_or_explicit

#define atomic_fetch_xor(object, operand)
#define atomic_fetch_xor_explicit

#define atomic_fetch_and(object, operand)
#define atomic_fetch_and_explicit

/* 7.17.8 Atomic flag type and operations */

atomic_flag;

#ifdef __cplusplus
#define ATOMIC_FLAG_INIT
#else
#define ATOMIC_FLAG_INIT
#endif

/* These should be provided by the libc implementation. */
#ifdef __cplusplus
bool atomic_flag_test_and_set(volatile atomic_flag *);
bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
#else
_Bool atomic_flag_test_and_set(volatile atomic_flag *);
_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
#endif
void atomic_flag_clear(volatile atomic_flag *);
void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);

#define atomic_flag_test_and_set(object)
#define atomic_flag_test_and_set_explicit(object, order)

#define atomic_flag_clear(object)
#define atomic_flag_clear_explicit(object, order)

#ifdef __cplusplus
}
#endif

#endif /* __STDC_HOSTED__ */
#endif /* __CLANG_STDATOMIC_H */