diff --git a/libcxx/docs/Contributing.rst b/libcxx/docs/Contributing.rst --- a/libcxx/docs/Contributing.rst +++ b/libcxx/docs/Contributing.rst @@ -49,7 +49,7 @@ - Did you add it to ``include/module.modulemap.in``? - Did you add it to ``include/CMakeLists.txt``? - - If it's a public header, did you update ``utils/libcxx/test/header_information.py``? + - If it's a public header, did you update ``utils/libcxx/header_information.py``? - Did you add the relevant feature test macro(s) for your feature? Did you update the ``generate_feature_test_macro_components.py`` script with it? - Did you run the ``libcxx-generate-files`` target and verify its output? diff --git a/libcxx/include/__std_clang_module b/libcxx/include/__std_clang_module --- a/libcxx/include/__std_clang_module +++ b/libcxx/include/__std_clang_module @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// WARNING, this entire header is generated by +// utils/generate_std_clang_module_header.py +// DO NOT MODIFY! + // This header should not be directly included, it's exclusively to import all // of the libc++ public clang modules for the `std` clang module to export. In // other words, it's to facilitate `@import std;` in Objective-C++ and `import std` @@ -17,7 +21,6 @@ # error "Do not include this header directly, include individual headers instead" #endif -#include <__availability> #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -27,52 +30,187 @@ #include #include #include -#include +#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif #include #include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif #include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif #include +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif +#include #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#include #include #include #include +#include #include #include #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#include #include #include #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif #include +#include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) +# include +#endif +#include +#include #include +#include +#include +#include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif +#include #include #include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include +#endif #include +#include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include +#endif #include #include #include #include +#include #include #include #include @@ -80,133 +218,9 @@ #include #include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# ifndef _LIBCPP_HAS_NO_FILESYSTEM -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include - -# include -#endif - -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include -# include - +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include -# include -#endif - -#ifdef _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT -# include -#endif - -#ifndef _LIBCPP_CXX03_LANG -# ifndef _LIBCPP_HAS_NO_THREADS -# include -# include -# include -# endif - -# include -# include -# include -# include -# include -# include -# include -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include #endif - -#if _LIBCPP_STD_VER >= 14 -# ifndef _LIBCPP_HAS_NO_THREADS -# include -# endif -#endif - -#if _LIBCPP_STD_VER >= 17 -# ifndef _LIBCPP_HAS_NO_FILESYSTEM -# include -# endif -#endif - -#if _LIBCPP_STD_VER >= 20 -# include - -# ifndef _LIBCPP_HAS_NO_THREADS -# include -# include -# include -# include -# endif -#endif - -#if _LIBCPP_STD_VER >= 23 -# ifndef _LIBCPP_HAS_NO_THREADS -# include -# endif +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -16,7 +16,6 @@ export * } module std_barrier [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "barrier" export * } @@ -37,7 +36,6 @@ export * } module std_codecvt [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "codecvt" export * } @@ -78,7 +76,6 @@ export * } module std_filesystem [system] { - @requires_LIBCXX_ENABLE_FILESYSTEM@ header "filesystem" export * } @@ -91,8 +88,6 @@ export * } module std_fstream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ - @requires_LIBCXX_ENABLE_FILESYSTEM@ header "fstream" export * } @@ -101,7 +96,6 @@ export * } module std_future [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "future" export * } @@ -110,12 +104,10 @@ export * } module std_iomanip [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "iomanip" export * } module std_ios [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "ios" export * } @@ -124,12 +116,10 @@ export * } module std_iostream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "iostream" export * } module std_istream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "istream" export * } @@ -138,7 +128,6 @@ export * } module std_latch [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "latch" export * } @@ -151,7 +140,6 @@ export * } module std_locale [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "locale" export * } @@ -192,7 +180,6 @@ export * } module std_ostream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "ostream" export * } @@ -217,7 +204,6 @@ export * } module std_regex [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "regex" export * } @@ -226,7 +212,6 @@ export * } module std_semaphore [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "semaphore" export * } @@ -235,7 +220,6 @@ export * } module std_shared_mutex [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "shared_mutex" export std_version } @@ -250,7 +234,6 @@ export std_private_span_span_fwd } module std_sstream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "sstream" export * } @@ -263,12 +246,10 @@ export * } module std_stop_token { - @requires_LIBCXX_ENABLE_THREADS@ header "stop_token" export * } module std_streambuf [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "streambuf" export * } @@ -281,7 +262,6 @@ export * } module std_strstream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "strstream" export * } @@ -290,7 +270,6 @@ export * } module std_thread [system] { - @requires_LIBCXX_ENABLE_THREADS@ header "thread" export * } @@ -377,7 +356,6 @@ export * } module std_clocale [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "clocale" export * } @@ -435,12 +413,10 @@ export * } module std_cwchar [system] { - @requires_LIBCXX_ENABLE_WIDE_CHARACTERS@ header "cwchar" export * } module std_cwctype [system] { - @requires_LIBCXX_ENABLE_WIDE_CHARACTERS@ header "cwctype" export * } @@ -477,7 +453,6 @@ export * } module std_locale_h [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "locale.h" export * } @@ -493,8 +468,6 @@ // FIXME: is missing. // provided by compiler. module std_stdatomic_h [system] { - @requires_LIBCXX_ENABLE_THREADS@ - requires cplusplus23 header "stdatomic.h" export * } @@ -536,21 +509,17 @@ } // provided by C library. module std_wchar_h [system] { - @requires_LIBCXX_ENABLE_WIDE_CHARACTERS@ // 's __need_* macros require textual inclusion. textual header "wchar.h" export * } module std_wctype_h [system] { - @requires_LIBCXX_ENABLE_WIDE_CHARACTERS@ header "wctype.h" export * } // Experimental C++ standard library interfaces module std_experimental [system] { - requires cplusplus11 - module deque { header "experimental/deque" export * @@ -657,7 +626,6 @@ export * } module std_private_locale [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "__locale" export * } @@ -1196,7 +1164,6 @@ } module std_private_chrono_file_clock [system] { header "__chrono/file_clock.h" } module std_private_chrono_formatter [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "__chrono/formatter.h" } module std_private_chrono_hh_mm_ss [system] { header "__chrono/hh_mm_ss.h" } @@ -1210,11 +1177,9 @@ module std_private_chrono_month_weekday [system] { header "__chrono/month_weekday.h" } module std_private_chrono_monthday [system] { header "__chrono/monthday.h" } module std_private_chrono_ostream [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "__chrono/ostream.h" } module std_private_chrono_parser_std_format_spec [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "__chrono/parser_std_format_spec.h" } module std_private_chrono_statically_widen [system] { header "__chrono/statically_widen.h" } @@ -1699,7 +1664,6 @@ module std_private_ranges_from_range [system] { header "__ranges/from_range.h" } module std_private_ranges_iota_view [system] { header "__ranges/iota_view.h" } module std_private_ranges_istream_view [system] { - @requires_LIBCXX_ENABLE_LOCALIZATION@ header "__ranges/istream_view.h" } module std_private_ranges_join_view [system] { diff --git a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py --- a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py @@ -14,7 +14,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: # Skip C compatibility headers. diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py --- a/libcxx/test/libcxx/clang_tidy.gen.py +++ b/libcxx/test/libcxx/clang_tidy.gen.py @@ -12,7 +12,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script diff --git a/libcxx/test/libcxx/double_include.gen.py b/libcxx/test/libcxx/double_include.gen.py --- a/libcxx/test/libcxx/double_include.gen.py +++ b/libcxx/test/libcxx/double_include.gen.py @@ -12,7 +12,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script diff --git a/libcxx/test/libcxx/header_inclusions.gen.py b/libcxx/test/libcxx/header_inclusions.gen.py --- a/libcxx/test/libcxx/header_inclusions.gen.py +++ b/libcxx/test/libcxx/header_inclusions.gen.py @@ -13,7 +13,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers, mandatory_inclusions +from libcxx.header_information import lit_header_restrictions, public_headers, mandatory_inclusions for header in public_headers: header_guard = lambda h: f"_LIBCPP_{h.upper().replace('.', '_').replace('/', '_')}" diff --git a/libcxx/test/libcxx/libcpp_version.gen.py b/libcxx/test/libcxx/libcpp_version.gen.py --- a/libcxx/test/libcxx/libcpp_version.gen.py +++ b/libcxx/test/libcxx/libcpp_version.gen.py @@ -12,7 +12,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: print(f"""\ diff --git a/libcxx/test/libcxx/module_std.gen.py b/libcxx/test/libcxx/module_std.gen.py --- a/libcxx/test/libcxx/module_std.gen.py +++ b/libcxx/test/libcxx/module_std.gen.py @@ -21,7 +21,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import toplevel_headers +from libcxx.header_information import toplevel_headers BLOCKLIT = ( "" # block Lit from interpreting a RUN/XFAIL/etc inside the generation script diff --git a/libcxx/test/libcxx/modules_include.gen.py b/libcxx/test/libcxx/modules_include.gen.py --- a/libcxx/test/libcxx/modules_include.gen.py +++ b/libcxx/test/libcxx/modules_include.gen.py @@ -14,10 +14,11 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers + +BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script for header in public_headers: - BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script print(f"""\ //--- {header}.compile.pass.cpp // RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only @@ -45,7 +46,7 @@ #include <{header}> """) -print(f""" +print(f"""\ //--- __std_clang_module.compile.pass.mm // RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only @@ -68,10 +69,6 @@ // TODO: Investigate this failure // UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME -// Lit seems to compile this twice: once with the default flags and once with with -// the flags specified in the RUN directive. Guard the first compile from failing. -#if __has_feature(modules) @import std; -#endif """) diff --git a/libcxx/test/libcxx/nasty_macros.gen.py b/libcxx/test/libcxx/nasty_macros.gen.py --- a/libcxx/test/libcxx/nasty_macros.gen.py +++ b/libcxx/test/libcxx/nasty_macros.gen.py @@ -13,7 +13,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: print(f"""\ diff --git a/libcxx/test/libcxx/no_assert_include.gen.py b/libcxx/test/libcxx/no_assert_include.gen.py --- a/libcxx/test/libcxx/no_assert_include.gen.py +++ b/libcxx/test/libcxx/no_assert_include.gen.py @@ -13,7 +13,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: if header == 'cassert': diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py --- a/libcxx/test/libcxx/transitive_includes.gen.py +++ b/libcxx/test/libcxx/transitive_includes.gen.py @@ -20,7 +20,7 @@ import sys sys.path.append(sys.argv[1]) -from libcxx.test.header_information import lit_header_restrictions, public_headers +from libcxx.header_information import lit_header_restrictions, public_headers import re diff --git a/libcxx/utils/CMakeLists.txt b/libcxx/utils/CMakeLists.txt --- a/libcxx/utils/CMakeLists.txt +++ b/libcxx/utils/CMakeLists.txt @@ -2,6 +2,10 @@ COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_feature_test_macro_components.py" COMMENT "Generate the header and tests for feature test macros.") +add_custom_target(libcxx-generate-std-clang-module-header + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/generate_std_clang_module_header.py" + COMMENT "Generate the <__std_clang_module> header") + add_custom_target(libcxx-generate-extended-grapheme-cluster-tables COMMAND "${Python3_EXECUTABLE}" @@ -38,6 +42,7 @@ add_custom_target(libcxx-generate-files DEPENDS libcxx-generate-feature-test-macros + libcxx-generate-std-clang-module-header libcxx-generate-extended-grapheme-cluster-tables libcxx-generate-extended-grapheme-cluster-tests libcxx-generate-escaped-output-table diff --git a/libcxx/utils/generate_std_clang_module_header.py b/libcxx/utils/generate_std_clang_module_header.py new file mode 100644 --- /dev/null +++ b/libcxx/utils/generate_std_clang_module_header.py @@ -0,0 +1,64 @@ +# ===----------------------------------------------------------------------===## +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ===----------------------------------------------------------------------===## + +import operator +import os.path + +import libcxx.header_information + +header_restrictions = libcxx.header_information.header_restrictions + +libcxx_include_directory = os.path.join( + os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "include" +) +with open( + os.path.join(libcxx_include_directory, "__std_clang_module"), "w" +) as std_clang_module_header: + std_clang_module_header.write( + """\ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// WARNING, this entire header is generated by +// utils/generate_std_clang_module_header.py +// DO NOT MODIFY! + +// This header should not be directly included, it's exclusively to import all +// of the libc++ public clang modules for the `std` clang module to export. In +// other words, it's to facilitate `@import std;` in Objective-C++ and `import std` +// in Swift to expose all of the libc++ interfaces. This is generally not +// recommended, however there are some clients that need to import all of libc++ +// without knowing what "all" is. +#if !__building_module(std) +# error "Do not include this header directly, include individual headers instead" +#endif + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +""" + ) + # Include the angle brackets in sorting so that sorts before + # like check-format wants. + for include, header in sorted([(f"<{header}>", header) for header in libcxx.header_information.public_headers]): + header_restriction = header_restrictions.get(header) + if header_restriction: + std_clang_module_header.write(f"#if {header_restriction}\n") + std_clang_module_header.write(f"# include {include}\n") + std_clang_module_header.write(f"#endif\n") + else: + std_clang_module_header.write(f"#include {include}\n") diff --git a/libcxx/utils/libcxx/test/header_information.py b/libcxx/utils/libcxx/header_information.py rename from libcxx/utils/libcxx/test/header_information.py rename to libcxx/utils/libcxx/header_information.py --- a/libcxx/utils/libcxx/test/header_information.py +++ b/libcxx/utils/libcxx/header_information.py @@ -8,6 +8,46 @@ import os, pathlib +header_restrictions = { + # headers with #error directives + "atomic": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)", + "stdatomic.h": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)", + + # headers with #error directives + "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "locale.h": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + # transitive includers of the above headers + "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "experimental/regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "iomanip": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "iostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "istream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "locale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "ostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "sstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "streambuf": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "strstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + + # headers with #error directives + "barrier": "!defined(_LIBCPP_HAS_NO_THREADS)", + "future": "!defined(_LIBCPP_HAS_NO_THREADS)", + "latch": "!defined(_LIBCPP_HAS_NO_THREADS)", + "semaphore": "!defined(_LIBCPP_HAS_NO_THREADS)", + "shared_mutex": "!defined(_LIBCPP_HAS_NO_THREADS)", + "stop_token": "!defined(_LIBCPP_HAS_NO_THREADS)", + "thread": "!defined(_LIBCPP_HAS_NO_THREADS)", + + # headers with #error directives + "wchar.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + "wctype.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + # transitive includers of the above headers + "cwchar": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + "cwctype": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", +} + lit_header_restrictions = { "barrier": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17", "clocale": "// UNSUPPORTED: no-localization", @@ -136,7 +176,7 @@ and file.name != "libcxx.imp" ) -libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) +libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) include = pathlib.Path(os.path.join(libcxx_root, "include")) test = pathlib.Path(os.path.join(libcxx_root, "test")) assert libcxx_root.exists()