| 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 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef _LIBCPP___CXX03___ATOMIC_MEMORY_ORDER_H |
| 10 |
#define _LIBCPP___CXX03___ATOMIC_MEMORY_ORDER_H |
| 11 |
|
| 12 |
#include <__cxx03/__config> |
| 13 |
#include <__cxx03/__type_traits/is_same.h> |
| 14 |
#include <__cxx03/__type_traits/underlying_type.h> |
| 15 |
|
| 16 |
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 |
# pragma GCC system_header |
| 18 |
#endif |
| 19 |
|
| 20 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 21 |
|
| 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 }; |
| 26 |
|
| 27 |
using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type; |
| 28 |
|
| 29 |
enum memory_order { |
| 30 |
memory_order_relaxed = __mo_relaxed, |
| 31 |
memory_order_consume = __mo_consume, |
| 32 |
memory_order_acquire = __mo_acquire, |
| 33 |
memory_order_release = __mo_release, |
| 34 |
memory_order_acq_rel = __mo_acq_rel, |
| 35 |
memory_order_seq_cst = __mo_seq_cst, |
| 36 |
}; |
| 37 |
|
| 38 |
_LIBCPP_END_NAMESPACE_STD |
| 39 |
|
| 40 |
#endif // _LIBCPP___CXX03___ATOMIC_MEMORY_ORDER_H |