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___ATOMIC_CHECK_MEMORY_ORDER_H 10 #define _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H 11 12 #include <__config> 13 14 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 15 # pragma GCC system_header 16 #endif 17 18 #define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \ 19 _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, \ 20 "memory order argument to atomic operation is invalid") 21 22 #define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \ 23 _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || __m == memory_order_acq_rel, \ 24 "memory order argument to atomic operation is invalid") 25 26 #define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \ 27 _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || __f == memory_order_acq_rel, \ 28 "memory order argument to atomic operation is invalid") 29 30 #define _LIBCPP_CHECK_WAIT_MEMORY_ORDER(__m) \ 31 _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || __m == memory_order_acq_rel, \ 32 "memory order argument to atomic operation is invalid") 33 34 #endif // _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H 35