[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __atomic / to_gcc_order.h
blobd04c111addd3143d474eb23844fca6c5c09e88c9
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_TO_GCC_ORDER_H
10 #define _LIBCPP___ATOMIC_TO_GCC_ORDER_H
12 #include <__atomic/memory_order.h>
13 #include <__config>
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
17 #endif
19 _LIBCPP_BEGIN_NAMESPACE_STD
21 #if defined(__ATOMIC_RELAXED) && defined(__ATOMIC_CONSUME) && defined(__ATOMIC_ACQUIRE) && \
22 defined(__ATOMIC_RELEASE) && defined(__ATOMIC_ACQ_REL) && defined(__ATOMIC_SEQ_CST)
24 _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
25 // Avoid switch statement to make this a constexpr.
26 return __order == memory_order_relaxed
27 ? __ATOMIC_RELAXED
28 : (__order == memory_order_acquire
29 ? __ATOMIC_ACQUIRE
30 : (__order == memory_order_release
31 ? __ATOMIC_RELEASE
32 : (__order == memory_order_seq_cst
33 ? __ATOMIC_SEQ_CST
34 : (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL : __ATOMIC_CONSUME))));
37 _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
38 // Avoid switch statement to make this a constexpr.
39 return __order == memory_order_relaxed
40 ? __ATOMIC_RELAXED
41 : (__order == memory_order_acquire
42 ? __ATOMIC_ACQUIRE
43 : (__order == memory_order_release
44 ? __ATOMIC_RELAXED
45 : (__order == memory_order_seq_cst
46 ? __ATOMIC_SEQ_CST
47 : (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE : __ATOMIC_CONSUME))));
50 #endif
52 _LIBCPP_END_NAMESPACE_STD
54 #endif // _LIBCPP___ATOMIC_TO_GCC_ORDER_H