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// <thread>
15
16// Test the feature test macros defined by <thread>
17
18// clang-format off
19
20#include <thread>
21#include "test_macros.h"
22
23#if TEST_STD_VER < 14
24
25# ifdef __cpp_lib_formatters
26# error "__cpp_lib_formatters should not be defined before c++23"
27# endif
28
29# ifdef __cpp_lib_jthread
30# error "__cpp_lib_jthread should not be defined before c++20"
31# endif
32
33#elif TEST_STD_VER == 14
34
35# ifdef __cpp_lib_formatters
36# error "__cpp_lib_formatters should not be defined before c++23"
37# endif
38
39# ifdef __cpp_lib_jthread
40# error "__cpp_lib_jthread should not be defined before c++20"
41# endif
42
43#elif TEST_STD_VER == 17
44
45# ifdef __cpp_lib_formatters
46# error "__cpp_lib_formatters should not be defined before c++23"
47# endif
48
49# ifdef __cpp_lib_jthread
50# error "__cpp_lib_jthread should not be defined before c++20"
51# endif
52
53#elif TEST_STD_VER == 20
54
55# ifdef __cpp_lib_formatters
56# error "__cpp_lib_formatters should not be defined before c++23"
57# endif
58
59# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
60# ifndef __cpp_lib_jthread
61# error "__cpp_lib_jthread should be defined in c++20"
62# endif
63# if __cpp_lib_jthread != 201911L
64# error "__cpp_lib_jthread should have the value 201911L in c++20"
65# endif
66# else
67# ifdef __cpp_lib_jthread
68# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
69# endif
70# endif
71
72#elif TEST_STD_VER == 23
73
74# if !defined(_LIBCPP_VERSION)
75# ifndef __cpp_lib_formatters
76# error "__cpp_lib_formatters should be defined in c++23"
77# endif
78# if __cpp_lib_formatters != 202302L
79# error "__cpp_lib_formatters should have the value 202302L in c++23"
80# endif
81# else
82# ifdef __cpp_lib_formatters
83# error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
84# endif
85# endif
86
87# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
88# ifndef __cpp_lib_jthread
89# error "__cpp_lib_jthread should be defined in c++23"
90# endif
91# if __cpp_lib_jthread != 201911L
92# error "__cpp_lib_jthread should have the value 201911L in c++23"
93# endif
94# else
95# ifdef __cpp_lib_jthread
96# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
97# endif
98# endif
99
100#elif TEST_STD_VER > 23
101
102# if !defined(_LIBCPP_VERSION)
103# ifndef __cpp_lib_formatters
104# error "__cpp_lib_formatters should be defined in c++26"
105# endif
106# if __cpp_lib_formatters != 202302L
107# error "__cpp_lib_formatters should have the value 202302L in c++26"
108# endif
109# else
110# ifdef __cpp_lib_formatters
111# error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
112# endif
113# endif
114
115# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
116# ifndef __cpp_lib_jthread
117# error "__cpp_lib_jthread should be defined in c++26"
118# endif
119# if __cpp_lib_jthread != 201911L
120# error "__cpp_lib_jthread should have the value 201911L in c++26"
121# endif
122# else
123# ifdef __cpp_lib_jthread
124# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
125# endif
126# endif
127
128#endif // TEST_STD_VER > 23
129
130// clang-format on
131
132

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