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// WARNING: This test was generated by generate_feature_test_macro_components.py
10// and should not be edited manually.
11//
12// clang-format off
13
14// UNSUPPORTED: no-threads
15
16// <shared_mutex>
17
18// Test the feature test macros defined by <shared_mutex>
19
20/* Constant Value
21 __cpp_lib_shared_mutex 201505L [C++17]
22 __cpp_lib_shared_timed_mutex 201402L [C++14]
23*/
24
25#include <shared_mutex>
26#include "test_macros.h"
27
28#if TEST_STD_VER < 14
29
30# ifdef __cpp_lib_shared_mutex
31# error "__cpp_lib_shared_mutex should not be defined before c++17"
32# endif
33
34# ifdef __cpp_lib_shared_timed_mutex
35# error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
36# endif
37
38#elif TEST_STD_VER == 14
39
40# ifdef __cpp_lib_shared_mutex
41# error "__cpp_lib_shared_mutex should not be defined before c++17"
42# endif
43
44# if !defined(_LIBCPP_HAS_NO_THREADS)
45# ifndef __cpp_lib_shared_timed_mutex
46# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
47# endif
48# if __cpp_lib_shared_timed_mutex != 201402L
49# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
50# endif
51# else
52# ifdef __cpp_lib_shared_timed_mutex
53# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
54# endif
55# endif
56
57#elif TEST_STD_VER == 17
58
59# if !defined(_LIBCPP_HAS_NO_THREADS)
60# ifndef __cpp_lib_shared_mutex
61# error "__cpp_lib_shared_mutex should be defined in c++17"
62# endif
63# if __cpp_lib_shared_mutex != 201505L
64# error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
65# endif
66# else
67# ifdef __cpp_lib_shared_mutex
68# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
69# endif
70# endif
71
72# if !defined(_LIBCPP_HAS_NO_THREADS)
73# ifndef __cpp_lib_shared_timed_mutex
74# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
75# endif
76# if __cpp_lib_shared_timed_mutex != 201402L
77# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
78# endif
79# else
80# ifdef __cpp_lib_shared_timed_mutex
81# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
82# endif
83# endif
84
85#elif TEST_STD_VER == 20
86
87# if !defined(_LIBCPP_HAS_NO_THREADS)
88# ifndef __cpp_lib_shared_mutex
89# error "__cpp_lib_shared_mutex should be defined in c++20"
90# endif
91# if __cpp_lib_shared_mutex != 201505L
92# error "__cpp_lib_shared_mutex should have the value 201505L in c++20"
93# endif
94# else
95# ifdef __cpp_lib_shared_mutex
96# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
97# endif
98# endif
99
100# if !defined(_LIBCPP_HAS_NO_THREADS)
101# ifndef __cpp_lib_shared_timed_mutex
102# error "__cpp_lib_shared_timed_mutex should be defined in c++20"
103# endif
104# if __cpp_lib_shared_timed_mutex != 201402L
105# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++20"
106# endif
107# else
108# ifdef __cpp_lib_shared_timed_mutex
109# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
110# endif
111# endif
112
113#elif TEST_STD_VER == 23
114
115# if !defined(_LIBCPP_HAS_NO_THREADS)
116# ifndef __cpp_lib_shared_mutex
117# error "__cpp_lib_shared_mutex should be defined in c++23"
118# endif
119# if __cpp_lib_shared_mutex != 201505L
120# error "__cpp_lib_shared_mutex should have the value 201505L in c++23"
121# endif
122# else
123# ifdef __cpp_lib_shared_mutex
124# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
125# endif
126# endif
127
128# if !defined(_LIBCPP_HAS_NO_THREADS)
129# ifndef __cpp_lib_shared_timed_mutex
130# error "__cpp_lib_shared_timed_mutex should be defined in c++23"
131# endif
132# if __cpp_lib_shared_timed_mutex != 201402L
133# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++23"
134# endif
135# else
136# ifdef __cpp_lib_shared_timed_mutex
137# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
138# endif
139# endif
140
141#elif TEST_STD_VER > 23
142
143# if !defined(_LIBCPP_HAS_NO_THREADS)
144# ifndef __cpp_lib_shared_mutex
145# error "__cpp_lib_shared_mutex should be defined in c++26"
146# endif
147# if __cpp_lib_shared_mutex != 201505L
148# error "__cpp_lib_shared_mutex should have the value 201505L in c++26"
149# endif
150# else
151# ifdef __cpp_lib_shared_mutex
152# error "__cpp_lib_shared_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
153# endif
154# endif
155
156# if !defined(_LIBCPP_HAS_NO_THREADS)
157# ifndef __cpp_lib_shared_timed_mutex
158# error "__cpp_lib_shared_timed_mutex should be defined in c++26"
159# endif
160# if __cpp_lib_shared_timed_mutex != 201402L
161# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++26"
162# endif
163# else
164# ifdef __cpp_lib_shared_timed_mutex
165# error "__cpp_lib_shared_timed_mutex should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_THREADS)' is not met!"
166# endif
167# endif
168
169#endif // TEST_STD_VER > 23
170
171

source code of libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp