1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H
10 #define _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H
14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15 # pragma GCC system_header
18 #define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
19 _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
20 __m == memory_order_acquire || \
21 __m == memory_order_acq_rel, \
22 "memory order argument to atomic operation is invalid")
24 #define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
25 _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
26 __m == memory_order_acq_rel, \
27 "memory order argument to atomic operation is invalid")
29 #define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
30 _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
31 __f == memory_order_acq_rel, \
32 "memory order argument to atomic operation is invalid")
34 #endif // _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H