[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __atomic / memory_order.h
blob294121d1c4e7f4acfa031b5e6284d72f37ff7926
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ATOMIC_MEMORY_ORDER_H
10 #define _LIBCPP___ATOMIC_MEMORY_ORDER_H
12 #include <__config>
13 #include <__type_traits/is_same.h>
14 #include <__type_traits/underlying_type.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
18 #endif
20 _LIBCPP_BEGIN_NAMESPACE_STD
22 // Figure out what the underlying type for `memory_order` would be if it were
23 // declared as an unscoped enum (accounting for -fshort-enums). Use this result
24 // to pin the underlying type in C++20.
25 enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst };
27 using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type;
29 #if _LIBCPP_STD_VER >= 20
31 enum class memory_order : __memory_order_underlying_t {
32 relaxed = __mo_relaxed,
33 consume = __mo_consume,
34 acquire = __mo_acquire,
35 release = __mo_release,
36 acq_rel = __mo_acq_rel,
37 seq_cst = __mo_seq_cst
40 static_assert(is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value,
41 "unexpected underlying type for std::memory_order");
43 inline constexpr auto memory_order_relaxed = memory_order::relaxed;
44 inline constexpr auto memory_order_consume = memory_order::consume;
45 inline constexpr auto memory_order_acquire = memory_order::acquire;
46 inline constexpr auto memory_order_release = memory_order::release;
47 inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
48 inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;
50 #else
52 enum memory_order {
53 memory_order_relaxed = __mo_relaxed,
54 memory_order_consume = __mo_consume,
55 memory_order_acquire = __mo_acquire,
56 memory_order_release = __mo_release,
57 memory_order_acq_rel = __mo_acq_rel,
58 memory_order_seq_cst = __mo_seq_cst,
61 #endif // _LIBCPP_STD_VER >= 20
63 _LIBCPP_END_NAMESPACE_STD
65 #endif // _LIBCPP___ATOMIC_MEMORY_ORDER_H