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

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