diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -169,7 +169,7 @@ .. code-block:: cpp // In HelloWorldHandler.cpp - #include <__assert> // must include <__assert> before defining the handler + #include // must include any libc++ header before defining the handler (C compatibility headers excluded) void std::__libcpp_assertion_handler(char const* file, int line, char const* expression, char const* message) { std::printf("Assertion %s failed at %s:%d, more info: %s", expression, file, line, message); diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -733,6 +733,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__bits> #include <__config> #include <__debug> diff --git a/libcxx/include/any b/libcxx/include/any --- a/libcxx/include/any +++ b/libcxx/include/any @@ -80,6 +80,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__utility/forward.h> diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/libcxx/include/array @@ -112,7 +112,7 @@ #include <__algorithm/fill_n.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/swap_ranges.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__tuple> #include <__utility/integer_sequence.h> diff --git a/libcxx/include/atomic b/libcxx/include/atomic --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -518,6 +518,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__chrono/duration.h> #include <__config> diff --git a/libcxx/include/barrier b/libcxx/include/barrier --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -45,6 +45,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__thread/timed_backoff_policy.h> diff --git a/libcxx/include/bit b/libcxx/include/bit --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -61,7 +61,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__bit/bit_cast.h> #include <__bit/byteswap.h> #include <__bits> // __libcpp_clz diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -113,6 +113,7 @@ */ #include <__algorithm/fill.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__bit_reference> #include <__config> #include <__functional/unary_function.h> diff --git a/libcxx/include/cassert b/libcxx/include/cassert --- a/libcxx/include/cassert +++ b/libcxx/include/cassert @@ -16,6 +16,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/ccomplex b/libcxx/include/ccomplex --- a/libcxx/include/ccomplex +++ b/libcxx/include/ccomplex @@ -17,12 +17,11 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -// hh 080623 Created - #endif // _LIBCPP_CCOMPLEX diff --git a/libcxx/include/cctype b/libcxx/include/cctype --- a/libcxx/include/cctype +++ b/libcxx/include/cctype @@ -34,6 +34,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cerrno b/libcxx/include/cerrno --- a/libcxx/include/cerrno +++ b/libcxx/include/cerrno @@ -22,6 +22,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cfenv b/libcxx/include/cfenv --- a/libcxx/include/cfenv +++ b/libcxx/include/cfenv @@ -52,6 +52,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cfloat b/libcxx/include/cfloat --- a/libcxx/include/cfloat +++ b/libcxx/include/cfloat @@ -69,6 +69,7 @@ LDBL_TRUE_MIN // C11 */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/charconv b/libcxx/include/charconv --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -77,7 +77,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__bits> #include <__charconv/chars_format.h> diff --git a/libcxx/include/chrono b/libcxx/include/chrono --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -694,6 +694,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__chrono/calendar.h> #include <__chrono/convert_to_timespec.h> #include <__chrono/duration.h> diff --git a/libcxx/include/cinttypes b/libcxx/include/cinttypes --- a/libcxx/include/cinttypes +++ b/libcxx/include/cinttypes @@ -234,6 +234,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/ciso646 b/libcxx/include/ciso646 --- a/libcxx/include/ciso646 +++ b/libcxx/include/ciso646 @@ -15,6 +15,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/climits b/libcxx/include/climits --- a/libcxx/include/climits +++ b/libcxx/include/climits @@ -37,6 +37,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/clocale b/libcxx/include/clocale --- a/libcxx/include/clocale +++ b/libcxx/include/clocale @@ -34,6 +34,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cmath b/libcxx/include/cmath --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -304,6 +304,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt --- a/libcxx/include/codecvt +++ b/libcxx/include/codecvt @@ -54,6 +54,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__locale> #include diff --git a/libcxx/include/compare b/libcxx/include/compare --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -140,6 +140,7 @@ } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/common_comparison_category.h> #include <__compare/compare_partial_order_fallback.h> #include <__compare/compare_strong_order_fallback.h> diff --git a/libcxx/include/complex b/libcxx/include/complex --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -231,6 +231,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/concepts b/libcxx/include/concepts --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -129,6 +129,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__concepts/arithmetic.h> #include <__concepts/assignable.h> #include <__concepts/boolean_testable.h> diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable --- a/libcxx/include/condition_variable +++ b/libcxx/include/condition_variable @@ -106,6 +106,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__mutex_base> #include diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine --- a/libcxx/include/coroutine +++ b/libcxx/include/coroutine @@ -38,6 +38,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__coroutine/coroutine_handle.h> #include <__coroutine/coroutine_traits.h> diff --git a/libcxx/include/csetjmp b/libcxx/include/csetjmp --- a/libcxx/include/csetjmp +++ b/libcxx/include/csetjmp @@ -30,6 +30,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/csignal b/libcxx/include/csignal --- a/libcxx/include/csignal +++ b/libcxx/include/csignal @@ -39,6 +39,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdarg b/libcxx/include/cstdarg --- a/libcxx/include/cstdarg +++ b/libcxx/include/cstdarg @@ -31,6 +31,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdbool b/libcxx/include/cstdbool --- a/libcxx/include/cstdbool +++ b/libcxx/include/cstdbool @@ -19,6 +19,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -33,6 +33,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/cstdint b/libcxx/include/cstdint --- a/libcxx/include/cstdint +++ b/libcxx/include/cstdint @@ -140,6 +140,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio --- a/libcxx/include/cstdio +++ b/libcxx/include/cstdio @@ -95,6 +95,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib --- a/libcxx/include/cstdlib +++ b/libcxx/include/cstdlib @@ -81,6 +81,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstring b/libcxx/include/cstring --- a/libcxx/include/cstring +++ b/libcxx/include/cstring @@ -56,6 +56,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/ctgmath b/libcxx/include/ctgmath --- a/libcxx/include/ctgmath +++ b/libcxx/include/ctgmath @@ -18,6 +18,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include diff --git a/libcxx/include/ctime b/libcxx/include/ctime --- a/libcxx/include/ctime +++ b/libcxx/include/ctime @@ -45,6 +45,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cuchar b/libcxx/include/cuchar --- a/libcxx/include/cuchar +++ b/libcxx/include/cuchar @@ -34,6 +34,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar --- a/libcxx/include/cwchar +++ b/libcxx/include/cwchar @@ -102,6 +102,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/cwctype b/libcxx/include/cwctype --- a/libcxx/include/cwctype +++ b/libcxx/include/cwctype @@ -49,6 +49,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -169,7 +169,7 @@ #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/iterator_traits.h> #include <__split_buffer> diff --git a/libcxx/include/exception b/libcxx/include/exception --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -76,6 +76,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__memory/addressof.h> diff --git a/libcxx/include/execution b/libcxx/include/execution --- a/libcxx/include/execution +++ b/libcxx/include/execution @@ -10,6 +10,7 @@ #ifndef _LIBCPP_EXECUTION #define _LIBCPP_EXECUTION +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/experimental/algorithm b/libcxx/include/experimental/algorithm --- a/libcxx/include/experimental/algorithm +++ b/libcxx/include/experimental/algorithm @@ -31,6 +31,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__debug> #include #include diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine --- a/libcxx/include/experimental/coroutine +++ b/libcxx/include/experimental/coroutine @@ -45,7 +45,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/deque b/libcxx/include/experimental/deque --- a/libcxx/include/experimental/deque +++ b/libcxx/include/experimental/deque @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_DEQUE #define _LIBCPP_EXPERIMENTAL_DEQUE + /* experimental/deque synopsis @@ -28,6 +29,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/forward_list b/libcxx/include/experimental/forward_list --- a/libcxx/include/experimental/forward_list +++ b/libcxx/include/experimental/forward_list @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_FORWARD_LIST #define _LIBCPP_EXPERIMENTAL_FORWARD_LIST + /* experimental/forward_list synopsis @@ -28,6 +29,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/functional b/libcxx/include/experimental/functional --- a/libcxx/include/experimental/functional +++ b/libcxx/include/experimental/functional @@ -60,6 +60,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__debug> #include <__memory/uses_allocator.h> #include diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -52,6 +52,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__memory/addressof.h> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/libcxx/include/experimental/list b/libcxx/include/experimental/list --- a/libcxx/include/experimental/list +++ b/libcxx/include/experimental/list @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_LIST #define _LIBCPP_EXPERIMENTAL_LIST + /* experimental/list synopsis @@ -28,6 +29,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/map b/libcxx/include/experimental/map --- a/libcxx/include/experimental/map +++ b/libcxx/include/experimental/map @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_MAP #define _LIBCPP_EXPERIMENTAL_MAP + /* experimental/map synopsis @@ -33,6 +34,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -64,7 +64,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__tuple> #include <__utility/move.h> #include diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const --- a/libcxx/include/experimental/propagate_const +++ b/libcxx/include/experimental/propagate_const @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST #define _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST + /* propagate_const synopsis @@ -106,6 +107,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__utility/move.h> #include <__utility/swap.h> #include diff --git a/libcxx/include/experimental/regex b/libcxx/include/experimental/regex --- a/libcxx/include/experimental/regex +++ b/libcxx/include/experimental/regex @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_REGEX #define _LIBCPP_EXPERIMENTAL_REGEX + /* experimental/regex synopsis @@ -35,6 +36,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/set b/libcxx/include/experimental/set --- a/libcxx/include/experimental/set +++ b/libcxx/include/experimental/set @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_SET #define _LIBCPP_EXPERIMENTAL_SET + /* experimental/set synopsis @@ -33,6 +34,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -649,6 +649,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/string b/libcxx/include/experimental/string --- a/libcxx/include/experimental/string +++ b/libcxx/include/experimental/string @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_STRING #define _LIBCPP_EXPERIMENTAL_STRING + /* experimental/string synopsis @@ -37,6 +38,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits --- a/libcxx/include/experimental/type_traits +++ b/libcxx/include/experimental/type_traits @@ -68,6 +68,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #if _LIBCPP_STD_VER > 11 diff --git a/libcxx/include/experimental/unordered_map b/libcxx/include/experimental/unordered_map --- a/libcxx/include/experimental/unordered_map +++ b/libcxx/include/experimental/unordered_map @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_MAP #define _LIBCPP_EXPERIMENTAL_UNORDERED_MAP + /* experimental/unordered_map synopsis @@ -39,6 +40,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/unordered_set b/libcxx/include/experimental/unordered_set --- a/libcxx/include/experimental/unordered_set +++ b/libcxx/include/experimental/unordered_set @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_SET #define _LIBCPP_EXPERIMENTAL_UNORDERED_SET + /* experimental/unordered_set synopsis @@ -33,6 +34,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility --- a/libcxx/include/experimental/utility +++ b/libcxx/include/experimental/utility @@ -30,6 +30,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include diff --git a/libcxx/include/experimental/vector b/libcxx/include/experimental/vector --- a/libcxx/include/experimental/vector +++ b/libcxx/include/experimental/vector @@ -9,6 +9,7 @@ #ifndef _LIBCPP_EXPERIMENTAL_VECTOR #define _LIBCPP_EXPERIMENTAL_VECTOR + /* experimental/vector synopsis @@ -28,6 +29,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include #include diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map --- a/libcxx/include/ext/hash_map +++ b/libcxx/include/ext/hash_map @@ -201,9 +201,10 @@ */ -#include <__algorithm/is_permutation.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__hash_table> +#include #include #include #include diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set --- a/libcxx/include/ext/hash_set +++ b/libcxx/include/ext/hash_set @@ -192,9 +192,10 @@ */ -#include <__algorithm/is_permutation.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__hash_table> +#include #include #include diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// #ifndef _LIBCPP_FILESYSTEM #define _LIBCPP_FILESYSTEM + + /* filesystem synopsis @@ -238,6 +240,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__filesystem/copy_options.h> #include <__filesystem/directory_entry.h> diff --git a/libcxx/include/format b/libcxx/include/format --- a/libcxx/include/format +++ b/libcxx/include/format @@ -117,6 +117,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler // Make sure all feature-test macros are available. #include // Enable the contents of the header only when libc++ was built with LIBCXX_ENABLE_INCOMPLETE_FEATURES. diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -182,6 +182,7 @@ #include <__algorithm/comp.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/min.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__utility/forward.h> #include diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -180,7 +180,7 @@ */ #include <__algorithm/max.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__locale> diff --git a/libcxx/include/functional b/libcxx/include/functional --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -491,6 +491,7 @@ */ #include <__algorithm/search.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/compare_three_way.h> #include <__config> #include <__debug> diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -361,7 +361,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__chrono/duration.h> #include <__chrono/time_point.h> diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list --- a/libcxx/include/initializer_list +++ b/libcxx/include/initializer_list @@ -42,6 +42,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip --- a/libcxx/include/iomanip +++ b/libcxx/include/iomanip @@ -42,6 +42,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__string> #include diff --git a/libcxx/include/ios b/libcxx/include/ios --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -210,6 +210,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__ios/fpos.h> #include <__locale> diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -94,6 +94,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__mbstate_t.h> #include diff --git a/libcxx/include/iostream b/libcxx/include/iostream --- a/libcxx/include/iostream +++ b/libcxx/include/iostream @@ -33,6 +33,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/istream b/libcxx/include/istream --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -158,6 +158,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__utility/forward.h> #include diff --git a/libcxx/include/iterator b/libcxx/include/iterator --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -634,6 +634,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__iterator/access.h> diff --git a/libcxx/include/latch b/libcxx/include/latch --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -40,6 +40,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include diff --git a/libcxx/include/limits b/libcxx/include/limits --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -101,6 +101,8 @@ } // std */ + +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -184,7 +184,7 @@ #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> #include <__algorithm/min.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__utility/forward.h> diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -192,7 +192,7 @@ #include <__algorithm/max.h> #include <__algorithm/reverse.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__locale> diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -530,7 +530,7 @@ #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/is_transparent.h> #include <__iterator/iterator_traits.h> diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -804,6 +804,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__memory/addressof.h> #include <__memory/allocation_guard.h> diff --git a/libcxx/include/mutex b/libcxx/include/mutex --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -186,6 +186,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__mutex_base> #include <__threading_support> diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -86,6 +86,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include diff --git a/libcxx/include/numbers b/libcxx/include/numbers --- a/libcxx/include/numbers +++ b/libcxx/include/numbers @@ -58,6 +58,7 @@ } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/numeric b/libcxx/include/numeric --- a/libcxx/include/numeric +++ b/libcxx/include/numeric @@ -144,6 +144,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include // for isnormal #include diff --git a/libcxx/include/optional b/libcxx/include/optional --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -158,7 +158,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__concepts/invocable.h> #include <__config> diff --git a/libcxx/include/ostream b/libcxx/include/ostream --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -134,6 +134,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/queue b/libcxx/include/queue --- a/libcxx/include/queue +++ b/libcxx/include/queue @@ -220,6 +220,7 @@ #include <__algorithm/make_heap.h> #include <__algorithm/pop_heap.h> #include <__algorithm/push_heap.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/uses_allocator.h> diff --git a/libcxx/include/random b/libcxx/include/random --- a/libcxx/include/random +++ b/libcxx/include/random @@ -1677,6 +1677,7 @@ } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__random/bernoulli_distribution.h> #include <__random/binomial_distribution.h> diff --git a/libcxx/include/ranges b/libcxx/include/ranges --- a/libcxx/include/ranges +++ b/libcxx/include/ranges @@ -230,6 +230,7 @@ } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__ranges/access.h> #include <__ranges/all.h> diff --git a/libcxx/include/ratio b/libcxx/include/ratio --- a/libcxx/include/ratio +++ b/libcxx/include/ratio @@ -77,6 +77,7 @@ } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -763,7 +763,7 @@ */ #include <__algorithm/find.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/wrap_iter.h> #include <__locale> diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -109,6 +109,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__utility/forward.h> #include diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -45,6 +45,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__chrono/time_point.h> #include <__config> diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -473,7 +473,7 @@ #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/is_transparent.h> #include <__iterator/iterator_traits.h> diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -122,6 +122,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -127,7 +127,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__iterator/concepts.h> diff --git a/libcxx/include/sstream b/libcxx/include/sstream --- a/libcxx/include/sstream +++ b/libcxx/include/sstream @@ -180,6 +180,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__utility/swap.h> #include diff --git a/libcxx/include/stack b/libcxx/include/stack --- a/libcxx/include/stack +++ b/libcxx/include/stack @@ -98,6 +98,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/uses_allocator.h> diff --git a/libcxx/include/stdbool.h b/libcxx/include/stdbool.h --- a/libcxx/include/stdbool.h +++ b/libcxx/include/stdbool.h @@ -9,7 +9,6 @@ #ifndef _LIBCPP_STDBOOL_H #define _LIBCPP_STDBOOL_H - /* stdbool.h synopsis diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept --- a/libcxx/include/stdexcept +++ b/libcxx/include/stdexcept @@ -41,6 +41,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf --- a/libcxx/include/streambuf +++ b/libcxx/include/streambuf @@ -107,6 +107,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -522,7 +522,7 @@ #include <__algorithm/min.h> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__ios/fpos.h> diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -11,7 +11,8 @@ #define _LIBCPP_STRING_VIEW /* -string_view synopsis + + string_view synopsis namespace std { @@ -196,7 +197,7 @@ */ #include <__algorithm/min.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__ranges/concepts.h> #include <__ranges/data.h> diff --git a/libcxx/include/strstream b/libcxx/include/strstream --- a/libcxx/include/strstream +++ b/libcxx/include/strstream @@ -129,6 +129,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/system_error b/libcxx/include/system_error --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -142,6 +142,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__errc> #include <__functional/unary_function.h> diff --git a/libcxx/include/thread b/libcxx/include/thread --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -82,7 +82,7 @@ */ -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__mutex_base> #include <__thread/poll_with_backoff.h> diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -165,6 +165,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__compare/common_comparison_category.h> #include <__compare/synth_three_way.h> #include <__config> diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -416,6 +416,8 @@ } */ + +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex --- a/libcxx/include/typeindex +++ b/libcxx/include/typeindex @@ -44,6 +44,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/unary_function.h> #include diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -56,6 +56,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -515,7 +515,7 @@ */ #include <__algorithm/is_permutation.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__functional/is_transparent.h> diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -460,7 +460,7 @@ */ #include <__algorithm/is_permutation.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> #include <__functional/is_transparent.h> diff --git a/libcxx/include/utility b/libcxx/include/utility --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -220,8 +220,8 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__debug> #include <__tuple> #include <__utility/as_const.h> #include <__utility/auto_cast.h> diff --git a/libcxx/include/valarray b/libcxx/include/valarray --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -348,6 +348,7 @@ #include <__algorithm/min.h> #include <__algorithm/min_element.h> #include <__algorithm/unwrap_iter.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -199,6 +199,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> #include <__functional/hash.h> diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -279,7 +279,7 @@ #include <__algorithm/remove_if.h> #include <__algorithm/rotate.h> #include <__algorithm/unwrap_iter.h> -#include <__assert> +#include <__assert> // all public C++ headers provide the assertion handler #include <__bit_reference> #include <__config> #include <__debug> diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -193,6 +193,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp b/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp --- a/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp +++ b/libcxx/test/libcxx/assertions/assertions_disabled.pass.cpp @@ -12,7 +12,6 @@ // ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 -#include <__assert> #include bool executed_condition = false; diff --git a/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp b/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp --- a/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp @@ -14,7 +14,6 @@ // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED -#include <__assert> #include bool handler_called = false; diff --git a/libcxx/test/libcxx/assertions/customize_handler.pass.cpp b/libcxx/test/libcxx/assertions/customize_handler.pass.cpp --- a/libcxx/test/libcxx/assertions/customize_handler.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_handler.pass.cpp @@ -14,7 +14,6 @@ // failures when back-deploying. // UNSUPPORTED: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11|12}} -#include <__assert> #include bool handler_called = false; diff --git a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp b/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp --- a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp +++ b/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp @@ -16,7 +16,6 @@ // failures when back-deploying. // UNSUPPORTED: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11|12}} -#include <__assert> #include bool handler_called = false; diff --git a/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp b/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp --- a/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp +++ b/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp @@ -14,7 +14,6 @@ // failures when back-deploying. // UNSUPPORTED: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11|12}} -#include <__assert> #include #include diff --git a/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp b/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp --- a/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp +++ b/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp @@ -13,7 +13,7 @@ // REQUIRES: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11|12}} -#include <__assert> +#include // any header would work void f() { _LIBCPP_ASSERT(true, "message"); // expected-error {{'__libcpp_assertion_handler' is unavailable}} diff --git a/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp @@ -0,0 +1,762 @@ +//===----------------------------------------------------------------------===// +// +// 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 all public C++ headers define the assertion handler. + +/* +BEGIN-SCRIPT + +for i, header in enumerate(public_headers): + # Skip C compatibility headers. + if header.endswith('.h'): + continue + + vars = { + 'run': 'RUN', + 'i': i, + 'restrictions': ' && ' + header_restrictions[header] if header in header_restrictions else '', + 'header': header + } + + print("""\ +// {run}: %{{build}} -DTEST_{i} +#if defined(TEST_{i}){restrictions} +# include <{header}> + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif +""".format(**vars)) + +END-SCRIPT +*/ + +#include <__config> + +// Prevent from generating deprecated warnings for this test. +#if defined(__DEPRECATED) +# undef __DEPRECATED +#endif + +int main(int, char**) { return 0; } + +// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW +// GENERATED-MARKER +// RUN: %{build} -DTEST_0 +#if defined(TEST_0) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_1 +#if defined(TEST_1) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_2 +#if defined(TEST_2) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_3 +#if defined(TEST_3) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_4 +#if defined(TEST_4) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_5 +#if defined(TEST_5) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_6 +#if defined(TEST_6) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_7 +#if defined(TEST_7) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_8 +#if defined(TEST_8) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_9 +#if defined(TEST_9) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_10 +#if defined(TEST_10) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_11 +#if defined(TEST_11) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_12 +#if defined(TEST_12) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_13 +#if defined(TEST_13) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_14 +#if defined(TEST_14) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_15 +#if defined(TEST_15) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_16 +#if defined(TEST_16) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_17 +#if defined(TEST_17) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_18 +#if defined(TEST_18) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_19 +#if defined(TEST_19) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_20 +#if defined(TEST_20) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_21 +#if defined(TEST_21) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_22 +#if defined(TEST_22) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_24 +#if defined(TEST_24) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_25 +#if defined(TEST_25) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_26 +#if defined(TEST_26) && !defined(_LIBCPP_HAS_NO_CXX20_COROUTINES) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_27 +#if defined(TEST_27) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_28 +#if defined(TEST_28) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_29 +#if defined(TEST_29) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_30 +#if defined(TEST_30) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_31 +#if defined(TEST_31) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_32 +#if defined(TEST_32) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_33 +#if defined(TEST_33) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_34 +#if defined(TEST_34) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_35 +#if defined(TEST_35) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_36 +#if defined(TEST_36) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_37 +#if defined(TEST_37) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_39 +#if defined(TEST_39) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_40 +#if defined(TEST_40) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_41 +#if defined(TEST_41) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_42 +#if defined(TEST_42) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_44 +#if defined(TEST_44) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_45 +#if defined(TEST_45) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_47 +#if defined(TEST_47) && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_49 +#if defined(TEST_49) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_50 +#if defined(TEST_50) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_51 +#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_52 +#if defined(TEST_52) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_53 +#if defined(TEST_53) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_54 +#if defined(TEST_54) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_56 +#if defined(TEST_56) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_57 +#if defined(TEST_57) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_58 +#if defined(TEST_58) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_59 +#if defined(TEST_59) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_60 +#if defined(TEST_60) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_61 +#if defined(TEST_61) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_62 +#if defined(TEST_62) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_63 +#if defined(TEST_63) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_65 +#if defined(TEST_65) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_66 +#if defined(TEST_66) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_68 +#if defined(TEST_68) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_70 +#if defined(TEST_70) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_71 +#if defined(TEST_71) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_72 +#if defined(TEST_72) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_73 +#if defined(TEST_73) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_74 +#if defined(TEST_74) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_75 +#if defined(TEST_75) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_76 +#if defined(TEST_76) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_77 +#if defined(TEST_77) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_78 +#if defined(TEST_78) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_79 +#if defined(TEST_79) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_80 +#if defined(TEST_80) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_81 +#if defined(TEST_81) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_82 +#if defined(TEST_82) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_83 +#if defined(TEST_83) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_84 +#if defined(TEST_84) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_86 +#if defined(TEST_86) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_87 +#if defined(TEST_87) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_88 +#if defined(TEST_88) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_89 +#if defined(TEST_89) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_92 +#if defined(TEST_92) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_96 +#if defined(TEST_96) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_97 +#if defined(TEST_97) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_99 +#if defined(TEST_99) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_100 +#if defined(TEST_100) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_101 +#if defined(TEST_101) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_103 +#if defined(TEST_103) && !defined(_LIBCPP_HAS_NO_THREADS) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_104 +#if defined(TEST_104) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_105 +#if defined(TEST_105) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_106 +#if defined(TEST_106) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_107 +#if defined(TEST_107) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_109 +#if defined(TEST_109) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_110 +#if defined(TEST_110) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_111 +#if defined(TEST_111) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_112 +#if defined(TEST_112) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_113 +#if defined(TEST_113) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_114 +#if defined(TEST_114) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_115 +#if defined(TEST_115) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_118 +#if defined(TEST_118) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_119 +#if defined(TEST_119) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_120 +#if defined(TEST_120) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_121 +#if defined(TEST_121) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_122 +#if defined(TEST_122) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_123 +#if defined(TEST_123) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_124 +#if defined(TEST_124) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_125 +#if defined(TEST_125) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_126 +#if defined(TEST_126) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_127 +#if defined(TEST_127) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_128 +#if defined(TEST_128) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_129 +#if defined(TEST_129) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_130 +#if defined(TEST_130) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_131 +#if defined(TEST_131) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_132 +#if defined(TEST_132) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_133 +#if defined(TEST_133) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_134 +#if defined(TEST_134) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_135 +#if defined(TEST_135) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_136 +#if defined(TEST_136) && __cplusplus >= 201103L +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_137 +#if defined(TEST_137) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// RUN: %{build} -DTEST_138 +#if defined(TEST_138) +# include + using HandlerType = decltype(std::__libcpp_assertion_handler); +#endif + +// GENERATED-MARKER diff --git a/libcxx/utils/CMakeLists.txt b/libcxx/utils/CMakeLists.txt --- a/libcxx/utils/CMakeLists.txt +++ b/libcxx/utils/CMakeLists.txt @@ -15,9 +15,14 @@ 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 new file mode 100755 --- /dev/null +++ b/libcxx/utils/generate_assertion_tests.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python + +import contextlib +import glob +import io +import os +import pathlib +import re + +header_restrictions = { + "barrier": "!defined(_LIBCPP_HAS_NO_THREADS)", + "future": "!defined(_LIBCPP_HAS_NO_THREADS)", + "latch": "!defined(_LIBCPP_HAS_NO_THREADS)", + "mutex": "!defined(_LIBCPP_HAS_NO_THREADS)", + "semaphore": "!defined(_LIBCPP_HAS_NO_THREADS)", + "shared_mutex": "!defined(_LIBCPP_HAS_NO_THREADS)", + "thread": "!defined(_LIBCPP_HAS_NO_THREADS)", + + "filesystem": "!defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)", + "format": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)", + + "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "iomanip": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "iostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "istream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "locale.h": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "locale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "ostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "ranges": "!defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)", + "regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "sstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "streambuf": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "strstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + + "wctype.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + "cwctype": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + "cwchar": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + "wchar.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)", + + "experimental/coroutine": "!defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES)", + "coroutine": "!defined(_LIBCPP_HAS_NO_CXX20_COROUTINES)", + + "experimental/regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L", + "experimental/deque": "__cplusplus >= 201103L", + "experimental/map": "__cplusplus >= 201103L", + "experimental/memory_resource": "__cplusplus >= 201103L", + "experimental/forward_list": "__cplusplus >= 201103L", + "experimental/list": "__cplusplus >= 201103L", + "experimental/set": "__cplusplus >= 201103L", + "experimental/string": "__cplusplus >= 201103L", + "experimental/unordered_map": "__cplusplus >= 201103L", + "experimental/unordered_set": "__cplusplus >= 201103L", + "experimental/vector": "__cplusplus >= 201103L", +} + +private_headers_still_public_in_modules = [ + '__assert', '__bsd_locale_defaults.h', '__bsd_locale_fallbacks.h', '__config', + '__config_site.in', '__debug', '__hash_table', + '__libcpp_version', '__threading_support', '__tree', '__undef_macros' +] + +def find_script(file): + """Finds the script used to generate a file inside the file itself. The script is delimited by + BEGIN-SCRIPT and END-SCRIPT markers. + """ + with open(file, 'r') as f: + content = f.read() + + match = re.search(r'^BEGIN-SCRIPT$(.+)^END-SCRIPT$', content, flags=re.MULTILINE | re.DOTALL) + if not match: + raise RuntimeError("Was unable to find a script delimited with BEGIN-SCRIPT/END-SCRIPT markers in {}".format(test_file)) + return match.group(1) + +def execute_script(script, variables): + """Executes the provided Mako template with the given variables available during the + evaluation of the script, and returns the result. + """ + code = compile(script, 'fake-filename', 'exec') + output = io.StringIO() + with contextlib.redirect_stdout(output): + exec(code, variables) + output = output.getvalue() + return output + +def generate_new_file(file, new_content): + """Generates the new content of the file by inserting the new content in-between + two '// GENERATED-MARKER' markers located in the file. + """ + with open(file, 'r') as f: + old_content = f.read() + + try: + before, begin_marker, _, end_marker, after = re.split(r'(// GENERATED-MARKER\n)', old_content, flags=re.MULTILINE | re.DOTALL) + except ValueError: + raise RuntimeError("Failed to split {} based on markers, please make sure the file has exactly two '// GENERATED-MARKER' occurrences".format(file)) + + return before + begin_marker + new_content + end_marker + after + +def produce(test_file, variables): + script = find_script(test_file) + result = execute_script(script, variables) + new_content = generate_new_file(test_file, result) + with open(test_file, 'w', newline='\n') as f: + f.write(new_content) + +def is_header(file): + """Returns whether the given file is a header (i.e. not a directory or the modulemap file).""" + return not file.is_dir() and not file.name == 'module.modulemap' + +def main(): + monorepo_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + include = pathlib.Path(os.path.join(monorepo_root, 'libcxx', 'include')) + test = pathlib.Path(os.path.join(monorepo_root, 'libcxx', 'test')) + assert(monorepo_root.exists()) + + toplevel_headers = sorted(str(p.relative_to(include)) for p in include.glob('[a-z]*') if is_header(p)) + experimental_headers = sorted(str(p.relative_to(include)) for p in include.glob('experimental/[a-z]*') if is_header(p)) + extended_headers = sorted(str(p.relative_to(include)) for p in include.glob('ext/[a-z]*') if is_header(p)) + public_headers = toplevel_headers + experimental_headers + extended_headers + private_headers = sorted(str(p.relative_to(include)) for p in include.rglob('*') if is_header(p) and str(p.relative_to(include)).startswith('__')) + variables = { + 'toplevel_headers': toplevel_headers, + 'experimental_headers': experimental_headers, + 'extended_headers': extended_headers, + 'public_headers': public_headers, + 'private_headers': private_headers, + 'header_restrictions': header_restrictions, + 'private_headers_still_public_in_modules': private_headers_still_public_in_modules + } + + produce(test.joinpath('libcxx/assertions/headers_declare_assertion_handler.sh.cpp'), variables) + + +if __name__ == '__main__': + main() diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -937,6 +937,7 @@ */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)