131 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// WARNING: This test was generated by generate_feature_test_macro_components.py10// and should not be edited manually.11 12// UNSUPPORTED: no-threads13 14// <thread>15 16// Test the feature test macros defined by <thread>17 18// clang-format off19 20#include <thread>21#include "test_macros.h"22 23#if TEST_STD_VER < 1424 25# ifdef __cpp_lib_formatters26# error "__cpp_lib_formatters should not be defined before c++23"27# endif28 29# ifdef __cpp_lib_jthread30# error "__cpp_lib_jthread should not be defined before c++20"31# endif32 33#elif TEST_STD_VER == 1434 35# ifdef __cpp_lib_formatters36# error "__cpp_lib_formatters should not be defined before c++23"37# endif38 39# ifdef __cpp_lib_jthread40# error "__cpp_lib_jthread should not be defined before c++20"41# endif42 43#elif TEST_STD_VER == 1744 45# ifdef __cpp_lib_formatters46# error "__cpp_lib_formatters should not be defined before c++23"47# endif48 49# ifdef __cpp_lib_jthread50# error "__cpp_lib_jthread should not be defined before c++20"51# endif52 53#elif TEST_STD_VER == 2054 55# ifdef __cpp_lib_formatters56# error "__cpp_lib_formatters should not be defined before c++23"57# endif58 59# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS60# ifndef __cpp_lib_jthread61# error "__cpp_lib_jthread should be defined in c++20"62# endif63# if __cpp_lib_jthread != 201911L64# error "__cpp_lib_jthread should have the value 201911L in c++20"65# endif66# else67# ifdef __cpp_lib_jthread68# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"69# endif70# endif71 72#elif TEST_STD_VER == 2373 74# if !defined(_LIBCPP_VERSION)75# ifndef __cpp_lib_formatters76# error "__cpp_lib_formatters should be defined in c++23"77# endif78# if __cpp_lib_formatters != 202302L79# error "__cpp_lib_formatters should have the value 202302L in c++23"80# endif81# else82# ifdef __cpp_lib_formatters83# error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"84# endif85# endif86 87# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS88# ifndef __cpp_lib_jthread89# error "__cpp_lib_jthread should be defined in c++23"90# endif91# if __cpp_lib_jthread != 201911L92# error "__cpp_lib_jthread should have the value 201911L in c++23"93# endif94# else95# ifdef __cpp_lib_jthread96# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"97# endif98# endif99 100#elif TEST_STD_VER > 23101 102# if !defined(_LIBCPP_VERSION)103# ifndef __cpp_lib_formatters104# error "__cpp_lib_formatters should be defined in c++26"105# endif106# if __cpp_lib_formatters != 202302L107# error "__cpp_lib_formatters should have the value 202302L in c++26"108# endif109# else110# ifdef __cpp_lib_formatters111# error "__cpp_lib_formatters should not be defined because it is unimplemented in libc++!"112# endif113# endif114 115# if !defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS116# ifndef __cpp_lib_jthread117# error "__cpp_lib_jthread should be defined in c++26"118# endif119# if __cpp_lib_jthread != 201911L120# error "__cpp_lib_jthread should have the value 201911L in c++26"121# endif122# else123# ifdef __cpp_lib_jthread124# error "__cpp_lib_jthread should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_HAS_THREADS' is not met!"125# endif126# endif127 128#endif // TEST_STD_VER > 23129 130// clang-format on131