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 @@ -8,6 +8,7 @@ // REQUIRES: has-clang-tidy // XFAIL: modules-build + // RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* -- -Wno-unknown-warning-option %{compile_flags} // -Wno-unknown-warning-option tells clang-tidy to ignore '-W' command-line arguments that it doesn't know. // There are some GCC-specific ones where clang-tidy would warn otherwise. @@ -17,22 +18,28 @@ # undef __DEPRECATED #endif -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +/* +BEGIN-SCRIPT -// clang-format off +for header in public_headers: + print("{}#{}include <{}>{}".format( + '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', + 3 * ' ' if header in header_restrictions else '', + header, + '\n#endif' if header in header_restrictions else '' + )) -// WARNING: This test was generated by generate_header_tests.py -// and should not be edited manually. +END-SCRIPT +*/ -// Top level headers +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER #include #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -47,21 +54,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES -# include -#endif +#include #include #include #include @@ -75,94 +80,90 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# include +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include @@ -171,19 +172,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -197,42 +198,55 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include #endif - -// experimental headers #if __cplusplus >= 201103L -# include -# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif // __cplusplus >= 201103L - -// clang-format on - -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#include +// GENERATED-MARKER 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 @@ -21,22 +21,28 @@ # undef __DEPRECATED #endif -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +/* +BEGIN-SCRIPT -// clang-format off +for header in public_headers: + print("{}#{}include <{}>{}".format( + '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', + 3 * ' ' if header in header_restrictions else '', + header, + '\n#endif' if header in header_restrictions else '' + )) -// WARNING: This test was generated by generate_header_tests.py -// and should not be edited manually. +END-SCRIPT +*/ -// Top level headers +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER #include #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -51,21 +57,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES -# include -#endif +#include #include #include #include @@ -79,94 +83,90 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# include +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include @@ -175,19 +175,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -201,45 +201,58 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include #endif - -// experimental headers #if __cplusplus >= 201103L -# include -# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif // __cplusplus >= 201103L - -// clang-format on - -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#include +// GENERATED-MARKER #if defined(WITH_MAIN) int main(int, char**) { return 0; } 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 @@ -21,16 +21,22 @@ #define min() true #define max() true -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +/* +BEGIN-SCRIPT -// clang-format off +for header in public_headers: + print("{}#{}include <{}>\nTEST_MACROS();{}".format( + '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', + 3 * ' ' if header in header_restrictions else '', + header, + '\n#endif' if header in header_restrictions else '' + )) -// WARNING: This test was generated by generate_header_tests.py -// and should not be edited manually. +END-SCRIPT +*/ -// Top level headers +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER #include TEST_MACROS(); #include @@ -39,8 +45,8 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include @@ -69,14 +75,14 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include @@ -89,10 +95,8 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES -# include +#include TEST_MACROS(); -#endif #include TEST_MACROS(); #include @@ -119,12 +123,12 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include TEST_MACROS(); #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include TEST_MACROS(); #endif #include @@ -137,54 +141,52 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# include +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT -# include +#include TEST_MACROS(); -#endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include @@ -193,12 +195,12 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include @@ -207,8 +209,8 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include @@ -219,42 +221,40 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES -# include +#include TEST_MACROS(); -#endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include @@ -271,8 +271,8 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include @@ -281,16 +281,16 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include TEST_MACROS(); #endif #include TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include TEST_MACROS(); #endif #include @@ -317,63 +317,78 @@ TEST_MACROS(); #include TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include TEST_MACROS(); #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include TEST_MACROS(); #endif - -// experimental headers #if __cplusplus >= 201103L -# include +# include TEST_MACROS(); -# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -# include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# endif -# include +#endif +#include TEST_MACROS(); -# include +#include TEST_MACROS(); -# include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#include TEST_MACROS(); -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#endif +#include TEST_MACROS(); -# endif -# include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#include TEST_MACROS(); -# include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#include TEST_MACROS(); -# include +#if __cplusplus >= 201103L +# include TEST_MACROS(); -# include +#endif +#include TEST_MACROS(); -# include +#include TEST_MACROS(); -#endif // __cplusplus >= 201103L - -// clang-format on - -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +// 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 @@ -131,22 +131,28 @@ #define Xp NASTY_MACRO #define Xs NASTY_MACRO -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +/* +BEGIN-SCRIPT -// clang-format off +for header in public_headers: + print("{}#{}include <{}>{}".format( + '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', + 3 * ' ' if header in header_restrictions else '', + header, + '\n#endif' if header in header_restrictions else '' + )) -// WARNING: This test was generated by generate_header_tests.py -// and should not be edited manually. +END-SCRIPT +*/ -// Top level headers +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER #include #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -161,21 +167,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES -# include -#endif +#include #include #include #include @@ -189,94 +193,90 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# include +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include @@ -285,19 +285,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -311,42 +311,55 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include #endif - -// experimental headers #if __cplusplus >= 201103L -# include -# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif // __cplusplus >= 201103L - -// clang-format on - -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#include +// GENERATED-MARKER 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 @@ -17,22 +17,30 @@ # undef __DEPRECATED #endif -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +/* +BEGIN-SCRIPT -// clang-format off +for header in public_headers: + if header == 'cassert': + continue + print("{}#{}include <{}>{}".format( + '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', + 3 * ' ' if header in header_restrictions else '', + header, + '\n#endif' if header in header_restrictions else '' + )) -// WARNING: This test was generated by generate_header_tests.py -// and should not be edited manually. +END-SCRIPT +*/ -// Top level headers +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER #include #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -46,21 +54,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES -# include -#endif +#include #include #include #include @@ -74,94 +80,90 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif #include #include #include #include #include -#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# include +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES -# include -#endif +#include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include @@ -170,19 +172,19 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include #include -#ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include #endif #include #include -#ifndef _LIBCPP_HAS_NO_THREADS -# include +#if !defined(_LIBCPP_HAS_NO_THREADS) +# include #endif #include #include @@ -196,45 +198,58 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -# include +#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include #endif - -// experimental headers #if __cplusplus >= 201103L -# include -# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -# ifndef _LIBCPP_HAS_NO_LOCALIZATION -# include -# endif -# include -# include -# include -# include -# include -# include -# include -# include -#endif // __cplusplus >= 201103L - -// clang-format on - -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201103L +# include +#endif +#include +#if __cplusplus >= 201103L +# include +#endif +#include +#include +// GENERATED-MARKER #ifdef assert #error "Do not include cassert or assert.h in standard header files" diff --git a/libcxx/utils/CMakeLists.txt b/libcxx/utils/CMakeLists.txt --- a/libcxx/utils/CMakeLists.txt +++ b/libcxx/utils/CMakeLists.txt @@ -4,7 +4,7 @@ COMMENT "Generate tests checking for mandated transitive includes in public headers.") add_custom_target(libcxx-generate-public-header-tests - COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_header_tests.py" + COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_assertion_tests.py" COMMENT "Generate tests for including public headers.") add_custom_target(libcxx-generate-feature-test-macros @@ -15,14 +15,9 @@ COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_private_header_tests.py" COMMENT "Generate tests for ensuring that detail headers are private.") -add_custom_target(libcxx-generate-assertion-tests - COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_assertion_tests.py" - COMMENT "Generate tests for inclusion of <__assert>.") - add_custom_target(libcxx-generate-files DEPENDS libcxx-generate-public-header-transitive-inclusion-tests libcxx-generate-public-header-tests libcxx-generate-feature-test-macros libcxx-generate-private-header-tests - libcxx-generate-assertion-tests COMMENT "Create all the auto-generated files in libc++ and its tests.") diff --git a/libcxx/utils/generate_assertion_tests.py b/libcxx/utils/generate_assertion_tests.py --- a/libcxx/utils/generate_assertion_tests.py +++ b/libcxx/utils/generate_assertion_tests.py @@ -129,6 +129,11 @@ } produce(test.joinpath('libcxx/assertions/headers_declare_assertion_handler.sh.cpp'), variables) + 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/nasty_macros.compile.pass.cpp'), variables) + produce(test.joinpath('libcxx/no_assert_include.compile.pass.cpp'), variables) if __name__ == '__main__': diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py deleted file mode 100755 --- a/libcxx/utils/generate_header_tests.py +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env python - -import glob -import os -import posixpath -import re - - -def get_libcxx_paths(): - utils_path = os.path.dirname(os.path.abspath(__file__)) - script_name = os.path.basename(__file__) - assert os.path.exists(utils_path) - src_root = os.path.dirname(utils_path) - include_path = os.path.join(src_root, 'include') - assert os.path.exists(include_path) - libcxx_test_path = os.path.join(src_root, 'test', 'libcxx') - assert os.path.exists(libcxx_test_path) - return script_name, src_root, include_path, libcxx_test_path - - -script_name, source_root, include_path, libcxx_test_path = get_libcxx_paths() - -header_markup = { - "barrier": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "future": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "latch": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "mutex": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "semaphore": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "shared_mutex": ["ifndef _LIBCPP_HAS_NO_THREADS"], - "thread": ["ifndef _LIBCPP_HAS_NO_THREADS"], - - "filesystem": ["ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY"], - "format": ["ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT"], - - "clocale": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "codecvt": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "fstream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "iomanip": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "ios": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "iostream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "istream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "locale.h": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "locale": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "ostream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "ranges": ["ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES"], - "regex": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "sstream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "streambuf": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - "strstream": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], - - "wctype.h": ["ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS"], - "cwctype": ["ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS"], - "cwchar": ["ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS"], - "wchar.h": ["ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS"], - - "experimental/coroutine": ["ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES"], - "coroutine": ["ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES"], - "experimental/regex": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], -} - -allowed_extensions = ['', '.h'] -indent_width = 4 - - -begin_pattern = """\ -//////////////////////////////////////////////////////////////////////////////// -// BEGIN-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// -""" - -warning_note = """\ -// WARNING: This test was generated by {script_name} -// and should not be edited manually. - -""".format(script_name=script_name) - -end_pattern = """\ -//////////////////////////////////////////////////////////////////////////////// -// END-GENERATED-HEADERS -//////////////////////////////////////////////////////////////////////////////// -""" - -generated_part_pattern = re.compile(re.escape(begin_pattern) + ".*" + re.escape(end_pattern), - re.MULTILINE | re.DOTALL) - -headers_template = """\ -// Top level headers -{top_level_headers} - -// experimental headers -#if __cplusplus >= 201103L -{experimental_headers} -#endif // __cplusplus >= 201103L -""" - - -def should_keep_header(p, exclusions=None): - if os.path.isdir(p): - return False - - if exclusions: - relpath = os.path.relpath(p, include_path) - relpath = posixpath.join(*os.path.split(relpath)) - if relpath in exclusions: - return False - - return os.path.splitext(p)[1] in allowed_extensions - - -def produce_include(relpath, indent_level, post_include=None): - relpath = posixpath.join(*os.path.split(relpath)) - template = "{preamble}#{indentation}include <{include}>{post_include}{postamble}" - - base_indentation = ' '*(indent_width * indent_level) - next_indentation = base_indentation + ' '*(indent_width) - post_include = "\n{}".format(post_include) if post_include else '' - - markup = header_markup.get(relpath, None) - if markup: - preamble = '#{indentation}{directive}\n'.format( - directive=markup[0], - indentation=base_indentation, - ) - postamble = '\n#{indentation}endif'.format( - indentation=base_indentation, - ) - indentation = next_indentation - else: - preamble = '' - postamble = '' - indentation = base_indentation - - return template.format( - include=relpath, - post_include=post_include, - preamble=preamble, - postamble=postamble, - indentation=indentation, - ) - - -def produce_headers(path_parts, indent_level, post_include=None, exclusions=None): - pattern = os.path.join(*path_parts, '[a-z]*') - - files = sorted(glob.glob(pattern, recursive=False)) - - include_headers = [ - produce_include(os.path.relpath(p, include_path), - indent_level, post_include=post_include) - for p in files - if should_keep_header(p, exclusions) - ] - - return '\n'.join(include_headers) - - -def produce_top_level_headers(post_include=None, exclusions=None): - return produce_headers([include_path], 0, post_include=post_include, exclusions=exclusions) - - -def produce_experimental_headers(post_include=None, exclusions=None): - return produce_headers([include_path, 'experimental'], 1, post_include=post_include, exclusions=exclusions) - - -def produce_extended_headers(post_include=None, exclusions=None): - return produce_headers([include_path, 'ext'], 1, post_include=post_include, exclusions=exclusions) - - -def replace_generated_headers(test_path, test_str): - with open(test_path, 'r') as f: - content = f.read() - - preamble = begin_pattern + '\n// clang-format off\n\n' + warning_note - postamble = '\n// clang-format on\n\n' + end_pattern - content = generated_part_pattern.sub( - preamble + test_str + postamble, content) - - with open(test_path, 'w', newline='\n') as f: - f.write(content) - - -def produce_test(test_filename, exclusions=None, post_include=None): - test_str = headers_template.format( - top_level_headers=produce_top_level_headers( - post_include=post_include, - exclusions=exclusions, - ), - experimental_headers=produce_experimental_headers( - post_include=post_include, - ), - ) - - replace_generated_headers(os.path.join( - libcxx_test_path, test_filename), test_str) - - -def main(): - produce_test('clang_tidy.sh.cpp') - produce_test('double_include.sh.cpp') - produce_test('min_max_macros.compile.pass.cpp', post_include='TEST_MACROS();') - produce_test('nasty_macros.compile.pass.cpp') - produce_test('no_assert_include.compile.pass.cpp', exclusions=['cassert']) - - -if __name__ == '__main__': - main()