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 // UNSUPPORTED: libcpp-has-no-threads 10 11 // <atomic> 12 13 // #define ATOMIC_BOOL_LOCK_FREE unspecified 14 // #define ATOMIC_CHAR_LOCK_FREE unspecified 15 // #define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20 16 // #define ATOMIC_CHAR16_T_LOCK_FREE unspecified 17 // #define ATOMIC_CHAR32_T_LOCK_FREE unspecified 18 // #define ATOMIC_WCHAR_T_LOCK_FREE unspecified 19 // #define ATOMIC_SHORT_LOCK_FREE unspecified 20 // #define ATOMIC_INT_LOCK_FREE unspecified 21 // #define ATOMIC_LONG_LOCK_FREE unspecified 22 // #define ATOMIC_LLONG_LOCK_FREE unspecified 23 // #define ATOMIC_POINTER_LOCK_FREE unspecified 24 25 #include <atomic> 26 #include <cassert> 27 28 #include "test_macros.h" 29 main(int,char **)30int main(int, char**) 31 { 32 assert(ATOMIC_BOOL_LOCK_FREE == 0 || 33 ATOMIC_BOOL_LOCK_FREE == 1 || 34 ATOMIC_BOOL_LOCK_FREE == 2); 35 assert(ATOMIC_CHAR_LOCK_FREE == 0 || 36 ATOMIC_CHAR_LOCK_FREE == 1 || 37 ATOMIC_CHAR_LOCK_FREE == 2); 38 #if TEST_STD_VER > 17 && defined(__cpp_char8_t) 39 assert(ATOMIC_CHAR8_T_LOCK_FREE == 0 || 40 ATOMIC_CHAR8_T_LOCK_FREE == 1 || 41 ATOMIC_CHAR8_T_LOCK_FREE == 2); 42 #endif 43 assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 || 44 ATOMIC_CHAR16_T_LOCK_FREE == 1 || 45 ATOMIC_CHAR16_T_LOCK_FREE == 2); 46 assert(ATOMIC_CHAR32_T_LOCK_FREE == 0 || 47 ATOMIC_CHAR32_T_LOCK_FREE == 1 || 48 ATOMIC_CHAR32_T_LOCK_FREE == 2); 49 assert(ATOMIC_WCHAR_T_LOCK_FREE == 0 || 50 ATOMIC_WCHAR_T_LOCK_FREE == 1 || 51 ATOMIC_WCHAR_T_LOCK_FREE == 2); 52 assert(ATOMIC_SHORT_LOCK_FREE == 0 || 53 ATOMIC_SHORT_LOCK_FREE == 1 || 54 ATOMIC_SHORT_LOCK_FREE == 2); 55 assert(ATOMIC_INT_LOCK_FREE == 0 || 56 ATOMIC_INT_LOCK_FREE == 1 || 57 ATOMIC_INT_LOCK_FREE == 2); 58 assert(ATOMIC_LONG_LOCK_FREE == 0 || 59 ATOMIC_LONG_LOCK_FREE == 1 || 60 ATOMIC_LONG_LOCK_FREE == 2); 61 assert(ATOMIC_LLONG_LOCK_FREE == 0 || 62 ATOMIC_LLONG_LOCK_FREE == 1 || 63 ATOMIC_LLONG_LOCK_FREE == 2); 64 assert(ATOMIC_POINTER_LOCK_FREE == 0 || 65 ATOMIC_POINTER_LOCK_FREE == 1 || 66 ATOMIC_POINTER_LOCK_FREE == 2); 67 68 return 0; 69 } 70