diff --git a/libcxx/include/__filesystem/u8path.h b/libcxx/include/__filesystem/u8path.h --- a/libcxx/include/__filesystem/u8path.h +++ b/libcxx/include/__filesystem/u8path.h @@ -10,11 +10,19 @@ #ifndef _LIBCPP___FILESYSTEM_U8PATH_H #define _LIBCPP___FILESYSTEM_U8PATH_H +#include <__algorithm/unwrap_iter.h> #include <__availability> #include <__config> #include <__filesystem/path.h> +#include #include +// Only required on Windows for __widen_from_utf8, and included conservatively +// because it requires support for localization. +#if defined(_LIBCPP_WIN32API) +# include +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/include/barrier b/libcxx/include/barrier --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -50,6 +50,7 @@ #include <__config> #include <__thread/timed_backoff_policy.h> #include +#include #ifndef _LIBCPP_HAS_NO_TREE_BARRIER # include #endif diff --git a/libcxx/include/latch b/libcxx/include/latch --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -44,6 +44,7 @@ #include <__availability> #include <__config> #include +#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -3,7 +3,6 @@ // include cycle. module std_config [system] [extern_c] { header "__config" - header "__config_site" export * } @@ -370,7 +369,6 @@ export * } module barrier { - requires cplusplus14 header "barrier" export * } @@ -698,7 +696,6 @@ } } module latch { - requires cplusplus14 header "latch" export * } @@ -906,7 +903,6 @@ export * } module semaphore { - requires cplusplus14 header "semaphore" export * } diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -52,6 +52,7 @@ #include <__thread/timed_backoff_policy.h> #include <__threading_support> #include +#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -138,6 +138,7 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> +#include <__utility/forward.h> #include // for array #include // for byte #include // for iterators diff --git a/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp --- a/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp +++ b/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp @@ -641,13 +641,13 @@ #endif // RUN: %{build} -DTEST_119 -#if defined(TEST_119) +#if defined(TEST_119) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif // RUN: %{build} -DTEST_120 -#if defined(TEST_120) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#if defined(TEST_120) && __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif @@ -665,13 +665,13 @@ #endif // RUN: %{build} -DTEST_123 -#if defined(TEST_123) +#if defined(TEST_123) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif // RUN: %{build} -DTEST_124 -#if defined(TEST_124) +#if defined(TEST_124) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif @@ -695,7 +695,7 @@ #endif // RUN: %{build} -DTEST_128 -#if defined(TEST_128) +#if defined(TEST_128) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif @@ -713,7 +713,7 @@ #endif // RUN: %{build} -DTEST_131 -#if defined(TEST_131) +#if defined(TEST_131) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif @@ -725,7 +725,7 @@ #endif // RUN: %{build} -DTEST_133 -#if defined(TEST_133) +#if defined(TEST_133) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif @@ -743,7 +743,7 @@ #endif // RUN: %{build} -DTEST_136 -#if defined(TEST_136) +#if defined(TEST_136) && __cplusplus >= 201103L # include using HandlerType = decltype(std::__libcpp_assertion_handler); #endif diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp --- a/libcxx/test/libcxx/clang_tidy.sh.cpp +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -207,8 +207,10 @@ #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include #endif #if __cplusplus >= 201103L @@ -217,8 +219,12 @@ #if __cplusplus >= 201103L # include #endif -#include -#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif @@ -228,25 +234,33 @@ #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -210,8 +210,10 @@ #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include #endif #if __cplusplus >= 201103L @@ -220,8 +222,12 @@ #if __cplusplus >= 201103L # include #endif -#include -#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif @@ -231,25 +237,33 @@ #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif diff --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp --- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp @@ -329,9 +329,11 @@ # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#endif +#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include TEST_MACROS(); #endif @@ -343,10 +345,14 @@ # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -#include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); +#endif #if __cplusplus >= 201103L # include TEST_MACROS(); @@ -359,8 +365,10 @@ # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); +#endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include TEST_MACROS(); @@ -369,14 +377,18 @@ # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); +#endif #if __cplusplus >= 201103L # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); +#endif #if __cplusplus >= 201103L # include TEST_MACROS(); @@ -385,8 +397,10 @@ # include TEST_MACROS(); #endif -#include +#if __cplusplus >= 201103L +# include TEST_MACROS(); +#endif #if __cplusplus >= 201103L # include TEST_MACROS(); diff --git a/libcxx/test/libcxx/modules_include.sh.cpp b/libcxx/test/libcxx/modules_include.sh.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/modules_include.sh.cpp @@ -0,0 +1,610 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Test that we can include each header in a TU while using modules. +// This is important notably because the LLDB data formatters use +// libc++ headers with modules enabled. + +// The system-provided seems to be broken on AIX +// XFAIL: LIBCXX-AIX-FIXME + +// GCC doesn't support -fcxx-modules +// UNSUPPORTED: gcc + +// The Windows headers don't appear to be compatible with modules +// UNSUPPORTED: windows + +// TODO: Some headers produce errors when we include them and the library has been +// configured without support for them, which breaks the modules build. +// UNSUPPORTED: libcpp-has-no-localization, libcpp-has-no-filesystem-library, libcpp-has-no-threads, libcpp-has-no-wide-characters + +// Prevent from generating deprecated warnings for this test. +#if defined(__DEPRECATED) +# undef __DEPRECATED +#endif + +#include <__config> + +/* +BEGIN-SCRIPT + +for i, header in enumerate(public_headers): + print("// {}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fsyntax-only -DTEST_{}".format('RUN', i)) + if header in header_restrictions: + print("#if defined(TEST_{}) && {}".format(i, header_restrictions[header])) + else: + print("#if defined(TEST_{})".format(i)) + print("#include <{}>".format(header)) + print("#endif") + +END-SCRIPT +*/ + +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_0 +#if defined(TEST_0) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_1 +#if defined(TEST_1) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_2 +#if defined(TEST_2) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_3 +#if defined(TEST_3) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_4 +#if defined(TEST_4) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_5 +#if defined(TEST_5) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_6 +#if defined(TEST_6) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_7 +#if defined(TEST_7) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_8 +#if defined(TEST_8) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_9 +#if defined(TEST_9) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_10 +#if defined(TEST_10) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_11 +#if defined(TEST_11) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_12 +#if defined(TEST_12) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_13 +#if defined(TEST_13) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_14 +#if defined(TEST_14) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_15 +#if defined(TEST_15) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_16 +#if defined(TEST_16) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_17 +#if defined(TEST_17) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_18 +#if defined(TEST_18) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_19 +#if defined(TEST_19) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_20 +#if defined(TEST_20) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_21 +#if defined(TEST_21) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_22 +#if defined(TEST_22) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_23 +#if defined(TEST_23) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_24 +#if defined(TEST_24) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_25 +#if defined(TEST_25) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_26 +#if defined(TEST_26) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_27 +#if defined(TEST_27) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_28 +#if defined(TEST_28) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_29 +#if defined(TEST_29) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_30 +#if defined(TEST_30) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_31 +#if defined(TEST_31) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_32 +#if defined(TEST_32) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_33 +#if defined(TEST_33) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_34 +#if defined(TEST_34) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_35 +#if defined(TEST_35) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_36 +#if defined(TEST_36) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_37 +#if defined(TEST_37) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_38 +#if defined(TEST_38) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_39 +#if defined(TEST_39) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_40 +#if defined(TEST_40) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_41 +#if defined(TEST_41) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_42 +#if defined(TEST_42) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_43 +#if defined(TEST_43) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_44 +#if defined(TEST_44) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_45 +#if defined(TEST_45) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_46 +#if defined(TEST_46) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_47 +#if defined(TEST_47) && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_48 +#if defined(TEST_48) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_49 +#if defined(TEST_49) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_50 +#if defined(TEST_50) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_51 +#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_52 +#if defined(TEST_52) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_53 +#if defined(TEST_53) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_54 +#if defined(TEST_54) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_55 +#if defined(TEST_55) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_56 +#if defined(TEST_56) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_57 +#if defined(TEST_57) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_58 +#if defined(TEST_58) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_59 +#if defined(TEST_59) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_60 +#if defined(TEST_60) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_61 +#if defined(TEST_61) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_62 +#if defined(TEST_62) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_63 +#if defined(TEST_63) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_64 +#if defined(TEST_64) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_65 +#if defined(TEST_65) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_66 +#if defined(TEST_66) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_67 +#if defined(TEST_67) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_68 +#if defined(TEST_68) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_69 +#if defined(TEST_69) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_70 +#if defined(TEST_70) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_71 +#if defined(TEST_71) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_72 +#if defined(TEST_72) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_73 +#if defined(TEST_73) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_74 +#if defined(TEST_74) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_75 +#if defined(TEST_75) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_76 +#if defined(TEST_76) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_77 +#if defined(TEST_77) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_78 +#if defined(TEST_78) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_79 +#if defined(TEST_79) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_80 +#if defined(TEST_80) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_81 +#if defined(TEST_81) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_82 +#if defined(TEST_82) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_83 +#if defined(TEST_83) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_84 +#if defined(TEST_84) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_85 +#if defined(TEST_85) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_86 +#if defined(TEST_86) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_87 +#if defined(TEST_87) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_88 +#if defined(TEST_88) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_89 +#if defined(TEST_89) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_90 +#if defined(TEST_90) && __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_91 +#if defined(TEST_91) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_92 +#if defined(TEST_92) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_93 +#if defined(TEST_93) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_94 +#if defined(TEST_94) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_95 +#if defined(TEST_95) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_96 +#if defined(TEST_96) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_97 +#if defined(TEST_97) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_98 +#if defined(TEST_98) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_99 +#if defined(TEST_99) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_100 +#if defined(TEST_100) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_101 +#if defined(TEST_101) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_102 +#if defined(TEST_102) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_103 +#if defined(TEST_103) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_104 +#if defined(TEST_104) && !defined(_LIBCPP_HAS_NO_THREADS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_105 +#if defined(TEST_105) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_106 +#if defined(TEST_106) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_107 +#if defined(TEST_107) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_108 +#if defined(TEST_108) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_109 +#if defined(TEST_109) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_110 +#if defined(TEST_110) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_111 +#if defined(TEST_111) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_112 +#if defined(TEST_112) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_113 +#if defined(TEST_113) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_114 +#if defined(TEST_114) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_115 +#if defined(TEST_115) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_116 +#if defined(TEST_116) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_117 +#if defined(TEST_117) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_118 +#if defined(TEST_118) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_119 +#if defined(TEST_119) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_120 +#if defined(TEST_120) && __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_121 +#if defined(TEST_121) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_122 +#if defined(TEST_122) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_123 +#if defined(TEST_123) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_124 +#if defined(TEST_124) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_125 +#if defined(TEST_125) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_126 +#if defined(TEST_126) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_127 +#if defined(TEST_127) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_128 +#if defined(TEST_128) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_129 +#if defined(TEST_129) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_130 +#if defined(TEST_130) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_131 +#if defined(TEST_131) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_132 +#if defined(TEST_132) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_133 +#if defined(TEST_133) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_134 +#if defined(TEST_134) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_135 +#if defined(TEST_135) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_136 +#if defined(TEST_136) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_137 +#if defined(TEST_137) && __cplusplus >= 201103L +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_138 +#if defined(TEST_138) +#include +#endif +// RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fsyntax-only -DTEST_139 +#if defined(TEST_139) +#include +#endif +// GENERATED-MARKER diff --git a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp --- a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp @@ -324,8 +324,10 @@ #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include #endif #if __cplusplus >= 201103L @@ -334,8 +336,12 @@ #if __cplusplus >= 201103L # include #endif -#include -#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif @@ -345,25 +351,33 @@ #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif diff --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp --- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp +++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp @@ -207,8 +207,10 @@ #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include #endif -#include -#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include #endif #if __cplusplus >= 201103L @@ -217,8 +219,12 @@ #if __cplusplus >= 201103L # include #endif -#include -#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif @@ -228,25 +234,33 @@ #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif #if __cplusplus >= 201103L # include #endif -#include +#if __cplusplus >= 201103L +# include +#endif #if __cplusplus >= 201103L # include #endif diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py --- a/libcxx/utils/generate_header_tests.py +++ b/libcxx/utils/generate_header_tests.py @@ -39,18 +39,25 @@ "cwchar": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", "wchar.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", - "experimental/coroutine": "!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES)", - - "experimental/regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L", + "experimental/algorithm": "__cplusplus >= 201103L", + "experimental/coroutine": "__cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES)", "experimental/deque": "__cplusplus >= 201103L", - "experimental/map": "__cplusplus >= 201103L", - "experimental/memory_resource": "__cplusplus >= 201103L", "experimental/forward_list": "__cplusplus >= 201103L", + "experimental/functional": "__cplusplus >= 201103L", + "experimental/iterator": "__cplusplus >= 201103L", "experimental/list": "__cplusplus >= 201103L", + "experimental/map": "__cplusplus >= 201103L", + "experimental/memory_resource": "__cplusplus >= 201103L", + "experimental/propagate_const": "__cplusplus >= 201103L", + "experimental/regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L", "experimental/set": "__cplusplus >= 201103L", + "experimental/simd": "__cplusplus >= 201103L", + "experimental/span": "__cplusplus >= 201103L", "experimental/string": "__cplusplus >= 201103L", + "experimental/type_traits": "__cplusplus >= 201103L", "experimental/unordered_map": "__cplusplus >= 201103L", "experimental/unordered_set": "__cplusplus >= 201103L", + "experimental/utility": "__cplusplus >= 201103L", "experimental/vector": "__cplusplus >= 201103L", } @@ -133,6 +140,7 @@ produce(test.joinpath('libcxx/clang_tidy.sh.cpp'), variables) produce(test.joinpath('libcxx/double_include.sh.cpp'), variables) produce(test.joinpath('libcxx/min_max_macros.compile.pass.cpp'), variables) + produce(test.joinpath('libcxx/modules_include.sh.cpp'), variables) produce(test.joinpath('libcxx/nasty_macros.compile.pass.cpp'), variables) produce(test.joinpath('libcxx/no_assert_include.compile.pass.cpp'), variables) produce(test.joinpath('libcxx/private_headers.verify.cpp'), variables)