12c6217f2SLouis Dionne //===----------------------------------------------------------------------===//
22c6217f2SLouis Dionne //
32c6217f2SLouis Dionne // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42c6217f2SLouis Dionne // See https://llvm.org/LICENSE.txt for license information.
52c6217f2SLouis Dionne // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
62c6217f2SLouis Dionne //
72c6217f2SLouis Dionne //===----------------------------------------------------------------------===//
82c6217f2SLouis Dionne //
92c6217f2SLouis Dionne // WARNING: This test was generated by generate_feature_test_macro_components.py
102c6217f2SLouis Dionne // and should not be edited manually.
112c6217f2SLouis Dionne //
122c6217f2SLouis Dionne // clang-format off
132c6217f2SLouis Dionne 
14a7f9895cSLouis Dionne // UNSUPPORTED: no-threads
152c6217f2SLouis Dionne 
162c6217f2SLouis Dionne // <thread>
172c6217f2SLouis Dionne 
182c6217f2SLouis Dionne // Test the feature test macros defined by <thread>
192c6217f2SLouis Dionne 
202c6217f2SLouis Dionne /*  Constant                Value
2171400505SMark de Wever     __cpp_lib_formatters    202302L [C++23]
222c6217f2SLouis Dionne     __cpp_lib_jthread       201911L [C++20]
232c6217f2SLouis Dionne */
242c6217f2SLouis Dionne 
252c6217f2SLouis Dionne #include <thread>
262c6217f2SLouis Dionne #include "test_macros.h"
272c6217f2SLouis Dionne 
282c6217f2SLouis Dionne #if TEST_STD_VER < 14
292c6217f2SLouis Dionne 
3088622aabSMark de Wever # ifdef __cpp_lib_formatters
3171400505SMark de Wever #   error "__cpp_lib_formatters should not be defined before c++23"
3288622aabSMark de Wever # endif
3388622aabSMark de Wever 
342c6217f2SLouis Dionne # ifdef __cpp_lib_jthread
352c6217f2SLouis Dionne #   error "__cpp_lib_jthread should not be defined before c++20"
362c6217f2SLouis Dionne # endif
372c6217f2SLouis Dionne 
382c6217f2SLouis Dionne #elif TEST_STD_VER == 14
392c6217f2SLouis Dionne 
4088622aabSMark de Wever # ifdef __cpp_lib_formatters
4171400505SMark de Wever #   error "__cpp_lib_formatters should not be defined before c++23"
4288622aabSMark de Wever # endif
4388622aabSMark de Wever 
442c6217f2SLouis Dionne # ifdef __cpp_lib_jthread
452c6217f2SLouis Dionne #   error "__cpp_lib_jthread should not be defined before c++20"
462c6217f2SLouis Dionne # endif
472c6217f2SLouis Dionne 
482c6217f2SLouis Dionne #elif TEST_STD_VER == 17
492c6217f2SLouis Dionne 
5088622aabSMark de Wever # ifdef __cpp_lib_formatters
5171400505SMark de Wever #   error "__cpp_lib_formatters should not be defined before c++23"
5288622aabSMark de Wever # endif
5388622aabSMark de Wever 
542c6217f2SLouis Dionne # ifdef __cpp_lib_jthread
552c6217f2SLouis Dionne #   error "__cpp_lib_jthread should not be defined before c++20"
562c6217f2SLouis Dionne # endif
572c6217f2SLouis Dionne 
582c6217f2SLouis Dionne #elif TEST_STD_VER == 20
592c6217f2SLouis Dionne 
6088622aabSMark de Wever # ifdef __cpp_lib_formatters
6171400505SMark de Wever #   error "__cpp_lib_formatters should not be defined before c++23"
6288622aabSMark de Wever # endif
6388622aabSMark de Wever 
64*c6f3b7bcSNikolas Klauser # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
652c6217f2SLouis Dionne #   ifndef __cpp_lib_jthread
662c6217f2SLouis Dionne #     error "__cpp_lib_jthread should be defined in c++20"
672c6217f2SLouis Dionne #   endif
682c6217f2SLouis Dionne #   if __cpp_lib_jthread != 201911L
692c6217f2SLouis Dionne #     error "__cpp_lib_jthread should have the value 201911L in c++20"
702c6217f2SLouis Dionne #   endif
714fa812bbSHui # else
722c6217f2SLouis Dionne #   ifdef __cpp_lib_jthread
73*c6f3b7bcSNikolas Klauser #     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
742c6217f2SLouis Dionne #   endif
752c6217f2SLouis Dionne # endif
762c6217f2SLouis Dionne 
7700c97cbcSMark de Wever #elif TEST_STD_VER == 23
782c6217f2SLouis Dionne 
792c6217f2SLouis Dionne # if !defined(_LIBCPP_VERSION)
8088622aabSMark de Wever #   ifndef __cpp_lib_formatters
8171400505SMark de Wever #     error "__cpp_lib_formatters should be defined in c++23"
8288622aabSMark de Wever #   endif
8388622aabSMark de Wever #   if __cpp_lib_formatters != 202302L
8471400505SMark de Wever #     error "__cpp_lib_formatters should have the value 202302L in c++23"
8588622aabSMark de Wever #   endif
8688622aabSMark de Wever # else // _LIBCPP_VERSION
8788622aabSMark de Wever #   ifdef __cpp_lib_formatters
8888622aabSMark de Wever #     error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
8988622aabSMark de Wever #   endif
9088622aabSMark de Wever # endif
9188622aabSMark de Wever 
92*c6f3b7bcSNikolas Klauser # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
932c6217f2SLouis Dionne #   ifndef __cpp_lib_jthread
9471400505SMark de Wever #     error "__cpp_lib_jthread should be defined in c++23"
952c6217f2SLouis Dionne #   endif
962c6217f2SLouis Dionne #   if __cpp_lib_jthread != 201911L
9771400505SMark de Wever #     error "__cpp_lib_jthread should have the value 201911L in c++23"
982c6217f2SLouis Dionne #   endif
994fa812bbSHui # else
1002c6217f2SLouis Dionne #   ifdef __cpp_lib_jthread
101*c6f3b7bcSNikolas Klauser #     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
1022c6217f2SLouis Dionne #   endif
1032c6217f2SLouis Dionne # endif
1042c6217f2SLouis Dionne 
10500c97cbcSMark de Wever #elif TEST_STD_VER > 23
10600c97cbcSMark de Wever 
10700c97cbcSMark de Wever # if !defined(_LIBCPP_VERSION)
10800c97cbcSMark de Wever #   ifndef __cpp_lib_formatters
10900c97cbcSMark de Wever #     error "__cpp_lib_formatters should be defined in c++26"
11000c97cbcSMark de Wever #   endif
11100c97cbcSMark de Wever #   if __cpp_lib_formatters != 202302L
11200c97cbcSMark de Wever #     error "__cpp_lib_formatters should have the value 202302L in c++26"
11300c97cbcSMark de Wever #   endif
11400c97cbcSMark de Wever # else // _LIBCPP_VERSION
11500c97cbcSMark de Wever #   ifdef __cpp_lib_formatters
11600c97cbcSMark de Wever #     error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"
11700c97cbcSMark de Wever #   endif
11800c97cbcSMark de Wever # endif
11900c97cbcSMark de Wever 
120*c6f3b7bcSNikolas Klauser # if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
12100c97cbcSMark de Wever #   ifndef __cpp_lib_jthread
12200c97cbcSMark de Wever #     error "__cpp_lib_jthread should be defined in c++26"
12300c97cbcSMark de Wever #   endif
12400c97cbcSMark de Wever #   if __cpp_lib_jthread != 201911L
12500c97cbcSMark de Wever #     error "__cpp_lib_jthread should have the value 201911L in c++26"
12600c97cbcSMark de Wever #   endif
1274fa812bbSHui # else
12800c97cbcSMark de Wever #   ifdef __cpp_lib_jthread
129*c6f3b7bcSNikolas Klauser #     error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
13000c97cbcSMark de Wever #   endif
13100c97cbcSMark de Wever # endif
13200c97cbcSMark de Wever 
13300c97cbcSMark de Wever #endif // TEST_STD_VER > 23
1342c6217f2SLouis Dionne 
135