diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst index 3eab44abe8e9..0d7e3a99028f 100644 --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -169,7 +169,7 @@ and ``operator delete``. For example: .. 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 index 51a1781450fe..c199c5a0c73f 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -733,6 +733,7 @@ template */ +#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 index fc1641f6e0cd..bd0ea5677d84 100644 --- a/libcxx/include/any +++ b/libcxx/include/any @@ -80,6 +80,7 @@ namespace std { */ +#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 index 0b366080eefc..786dc7574669 100644 --- a/libcxx/include/array +++ b/libcxx/include/array @@ -112,7 +112,7 @@ template const T&& get(const array&&) noexce #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 index dfa01bf239f8..b5c6e5182a4f 100644 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -518,6 +518,7 @@ template */ +#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 index 0382f2f8277b..6f8a1f9f38be 100644 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -45,6 +45,7 @@ namespace std */ +#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 index aaefd8a362cf..b73c4b44c862 100644 --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -61,7 +61,7 @@ namespace std { */ -#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 index 07c9494d2e19..28862d8ed660 100644 --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -113,6 +113,7 @@ template struct hash>; */ #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 index 3c5bb7b11058..28fc0b10e9f4 100644 --- a/libcxx/include/cassert +++ b/libcxx/include/cassert @@ -16,6 +16,7 @@ Macros: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/ccomplex b/libcxx/include/ccomplex index f1037f284186..cf05c7a91081 100644 --- 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 index fc770cfba356..248f8d98000f 100644 --- a/libcxx/include/cctype +++ b/libcxx/include/cctype @@ -34,6 +34,7 @@ int toupper(int c); } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cerrno b/libcxx/include/cerrno index 9946c855b5d7..e9eacd35effe 100644 --- a/libcxx/include/cerrno +++ b/libcxx/include/cerrno @@ -22,6 +22,7 @@ Macros: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cfenv b/libcxx/include/cfenv index e1aae2f009ec..e42b46680d15 100644 --- a/libcxx/include/cfenv +++ b/libcxx/include/cfenv @@ -52,6 +52,7 @@ int feupdateenv(const fenv_t* envp); } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cfloat b/libcxx/include/cfloat index ff806cef9c4d..36a7c51cdda5 100644 --- a/libcxx/include/cfloat +++ b/libcxx/include/cfloat @@ -69,6 +69,7 @@ Macros: 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 index 3b766e606966..ca717dc4a046 100644 --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -77,7 +77,7 @@ namespace std { */ -#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 index 63558adbc4a0..c6efd33345ed 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -694,6 +694,7 @@ constexpr chrono::year operator ""y(unsigned lo } // 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 index 0674384b79d0..a4cfe961cc55 100644 --- a/libcxx/include/cinttypes +++ b/libcxx/include/cinttypes @@ -234,6 +234,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int } // 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 index 1d859f08fac5..e0cd722495ed 100644 --- 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 index c365ca79a46b..16800a652f6d 100644 --- a/libcxx/include/climits +++ b/libcxx/include/climits @@ -37,6 +37,7 @@ Macros: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/clocale b/libcxx/include/clocale index 1c1f244d2a02..892604207532 100644 --- a/libcxx/include/clocale +++ b/libcxx/include/clocale @@ -34,6 +34,7 @@ lconv* localeconv(); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cmath b/libcxx/include/cmath index be5cbe362666..2d22151684e0 100644 --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -304,6 +304,7 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt index b9b38b383423..d3a9486929f4 100644 --- a/libcxx/include/codecvt +++ b/libcxx/include/codecvt @@ -54,6 +54,7 @@ class codecvt_utf8_utf16 */ +#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 index 6f620e48f765..6aa1abefd3ef 100644 --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -140,6 +140,7 @@ namespace std { } */ +#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 index 8384ed897aa2..87a4e5872497 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -231,6 +231,7 @@ template complex tanh (const complex&); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/concepts b/libcxx/include/concepts index 99dbcf4561f2..301256ca7ef7 100644 --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -129,6 +129,7 @@ namespace std { */ +#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 index 6da724650046..dfcb7160565b 100644 --- a/libcxx/include/condition_variable +++ b/libcxx/include/condition_variable @@ -106,6 +106,7 @@ public: */ +#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 index 478f4723f9ad..11b2863e6666 100644 --- a/libcxx/include/coroutine +++ b/libcxx/include/coroutine @@ -38,6 +38,7 @@ struct suspend_always; */ +#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 index 76cbaab4c387..4f40bcbf61e9 100644 --- a/libcxx/include/csetjmp +++ b/libcxx/include/csetjmp @@ -30,6 +30,7 @@ void longjmp(jmp_buf env, int val); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/csignal b/libcxx/include/csignal index 19091cfaa2a5..81ca89091c1b 100644 --- a/libcxx/include/csignal +++ b/libcxx/include/csignal @@ -39,6 +39,7 @@ int raise(int sig); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdarg b/libcxx/include/cstdarg index 7dd906866ae0..f36ade202b7a 100644 --- a/libcxx/include/cstdarg +++ b/libcxx/include/cstdarg @@ -31,6 +31,7 @@ Types: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdbool b/libcxx/include/cstdbool index ef731c021a4a..ce608033a22c 100644 --- a/libcxx/include/cstdbool +++ b/libcxx/include/cstdbool @@ -19,6 +19,7 @@ Macros: */ +#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 index 57cecc7bd772..2a8b686bf388 100644 --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -33,6 +33,7 @@ Types: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/cstdint b/libcxx/include/cstdint index cac715bf0afa..83cda947b497 100644 --- a/libcxx/include/cstdint +++ b/libcxx/include/cstdint @@ -140,6 +140,7 @@ Types: } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio index d5b748d86ef7..d191086a85da 100644 --- a/libcxx/include/cstdio +++ b/libcxx/include/cstdio @@ -95,6 +95,7 @@ void perror(const char* s); } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib index 9fad7e10cca6..457c31f625d8 100644 --- a/libcxx/include/cstdlib +++ b/libcxx/include/cstdlib @@ -81,6 +81,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cstring b/libcxx/include/cstring index acf1c4d32680..37c92e149b8f 100644 --- a/libcxx/include/cstring +++ b/libcxx/include/cstring @@ -56,6 +56,7 @@ size_t strlen(const char* s); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/ctgmath b/libcxx/include/ctgmath index 6237979be490..bfcf2f98d470 100644 --- 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 index 58856e88736c..0c6e4dfd6f98 100644 --- a/libcxx/include/ctime +++ b/libcxx/include/ctime @@ -45,6 +45,7 @@ int timespec_get( struct timespec *ts, int base); // C++17 */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cuchar b/libcxx/include/cuchar index fec14929bd23..a4ed585d1aeb 100644 --- a/libcxx/include/cuchar +++ b/libcxx/include/cuchar @@ -34,6 +34,7 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar index c4d85215a2be..5c69ab2a7bb1 100644 --- a/libcxx/include/cwchar +++ b/libcxx/include/cwchar @@ -102,6 +102,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/cwctype b/libcxx/include/cwctype index b4434f62d4a6..429b00c2446d 100644 --- a/libcxx/include/cwctype +++ b/libcxx/include/cwctype @@ -49,6 +49,7 @@ wctrans_t wctrans(const char* property); */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/deque b/libcxx/include/deque index 184bae0fd971..4b78d77e6c7d 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -169,7 +169,7 @@ template #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 index a60c8e61b3c4..412e02af3822 100644 --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -76,6 +76,7 @@ template void rethrow_if_nested(const E& e); */ +#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 index f4693329c93f..040297038637 100644 --- 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 index b9405bfe5ff9..e0ca3c73be6b 100644 --- a/libcxx/include/experimental/algorithm +++ b/libcxx/include/experimental/algorithm @@ -31,6 +31,7 @@ ForwardIterator search(ForwardIterator first, ForwardIterator last, */ +#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 index 837ab10766df..e94450b1438a 100644 --- a/libcxx/include/experimental/coroutine +++ b/libcxx/include/experimental/coroutine @@ -45,7 +45,7 @@ template struct hash>; */ -#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 index 1809991b4735..3e3f9098a8fd 100644 --- 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 @@ namespace pmr { */ +#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 index 675ae0656aa2..4b102c554704 100644 --- 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 @@ namespace pmr { */ +#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 index 1291894aa088..0da5fced22ea 100644 --- a/libcxx/include/experimental/functional +++ b/libcxx/include/experimental/functional @@ -60,6 +60,7 @@ inline namespace fundamentals_v1 { */ +#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 index 137b206354f5..79c594fde42b 100644 --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -52,6 +52,7 @@ namespace std { */ +#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 index d15d816444e3..c8480575977e 100644 --- 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 @@ namespace pmr { */ +#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 index 25bc56ccb4d1..3dee7f703aeb 100644 --- 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 @@ namespace pmr { */ +#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 index 16c7d8de66c5..f7b19aafd40f 100644 --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -64,7 +64,7 @@ namespace pmr { */ -#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 index e6224225e3b1..7c9b783f4163 100644 --- 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 index f108d2e8d0c4..4dc2bbae4510 100644 --- 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 @@ namespace pmr { */ +#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 index 208952cb44d1..e2e75e35448b 100644 --- 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 @@ namespace pmr { */ +#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 index 93d39c872bc9..7fa185f4f395 100644 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -649,6 +649,7 @@ public: */ +#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 index aab916778f8a..c795d685d735 100644 --- 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 @@ namespace pmr { */ +#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 index 707cbde99125..dd4c53963640 100644 --- a/libcxx/include/experimental/type_traits +++ b/libcxx/include/experimental/type_traits @@ -68,6 +68,7 @@ inline namespace fundamentals_v1 { */ +#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 index 069ba203d5b0..71ce4408c49f 100644 --- 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 @@ namespace pmr { */ +#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 index cac6c76414ba..509f3ec1044e 100644 --- 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 @@ namespace pmr { */ +#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 index 21650a8d1ec1..576b8be46357 100644 --- a/libcxx/include/experimental/utility +++ b/libcxx/include/experimental/utility @@ -30,6 +30,7 @@ inline namespace fundamentals_v1 { */ +#include <__assert> // all public C++ headers provide the assertion handler #include #include diff --git a/libcxx/include/experimental/vector b/libcxx/include/experimental/vector index 1eb792758f4f..97c51c830c4a 100644 --- 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 @@ namespace pmr { */ +#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 index 1816626c977c..92572c08c24c 100644 --- a/libcxx/include/ext/hash_map +++ b/libcxx/include/ext/hash_map @@ -201,9 +201,10 @@ template */ -#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 index cbd621b3bd6f..eb6193940668 100644 --- a/libcxx/include/ext/hash_set +++ b/libcxx/include/ext/hash_set @@ -192,9 +192,10 @@ template */ -#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 index afb75df57491..c23cac9828b1 100644 --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #ifndef _LIBCPP_FILESYSTEM #define _LIBCPP_FILESYSTEM + /* filesystem synopsis @@ -238,6 +239,7 @@ inline constexpr bool std::ranges::enable_view // 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 index 5ff62c3f0fa6..6cefab4948d2 100644 --- a/libcxx/include/format +++ b/libcxx/include/format @@ -117,6 +117,7 @@ namespace std { */ +#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 index 4b3f4e2ec826..23c1229e7b5c 100644 --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -182,6 +182,7 @@ template #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 index 2f1cd32b35fb..907c59e888fb 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -180,7 +180,7 @@ typedef basic_fstream wfstream; */ #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 index d097861a9011..7430551c6578 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -491,6 +491,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited */ #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 index 162d40013602..b39747792261 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -361,7 +361,7 @@ template struct uses_allocator, Alloc>; */ -#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 index e61318e64efe..02a8ec57fab3 100644 --- a/libcxx/include/initializer_list +++ b/libcxx/include/initializer_list @@ -42,6 +42,7 @@ template const E* end(initializer_list il) noexcept; // constexpr in */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip index c4d8351926b6..69b55be7cc15 100644 --- a/libcxx/include/iomanip +++ b/libcxx/include/iomanip @@ -42,6 +42,7 @@ template */ +#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 index 15053e524682..a790ba5c1775 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -210,6 +210,7 @@ storage-class-specifier const error_category& iostream_category() noexcept; */ +#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 index 263a66771fb3..6cb55868c6be 100644 --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -94,6 +94,7 @@ using u32streampos = fpos::state_type>; */ +#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 index 10d17d6b4227..b5aef3efaa59 100644 --- a/libcxx/include/iostream +++ b/libcxx/include/iostream @@ -33,6 +33,7 @@ extern wostream wclog; */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/istream b/libcxx/include/istream index 8259c5252b2a..201339ff4db4 100644 --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -158,6 +158,7 @@ template */ +#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 index 8ba4d0ccb17c..4060c2d9d4fd 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -634,6 +634,7 @@ template constexpr const E* data(initializer_list il) noexcept; */ +#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 index 7df7fdaa85a0..d6cb47622268 100644 --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -40,6 +40,7 @@ namespace std */ +#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 index 5afef4bd7e06..35e4d85734de 100644 --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -101,6 +101,8 @@ template<> class numeric_limits; } // std */ + +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include diff --git a/libcxx/include/list b/libcxx/include/list index 31cacbc71d3a..c3337d458835 100644 --- a/libcxx/include/list +++ b/libcxx/include/list @@ -184,7 +184,7 @@ template #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 index 067c146d8234..8ff7567d865e 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -192,7 +192,7 @@ template class messages_byname; #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 index 8d26cdba17bd..7371d5182c0d 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -530,7 +530,7 @@ erase_if(multimap& c, Predicate pred); // C++20 #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 index 1991e29228d1..53172c58c3b4 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -804,6 +804,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); */ +#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 index 536cf9c6ead0..a94e3b7daef9 100644 --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -186,6 +186,7 @@ template */ +#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 index 0d8d43e8d3ca..e91a42253d5b 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -86,6 +86,7 @@ void operator delete[](void* ptr, void*) noexcept; */ +#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 index 22b185aeae6e..3c8527dfc2de 100644 --- a/libcxx/include/numbers +++ b/libcxx/include/numbers @@ -58,6 +58,7 @@ namespace std::numbers { } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/numeric b/libcxx/include/numeric index c8c6bced0a12..ef963365ae71 100644 --- a/libcxx/include/numeric +++ b/libcxx/include/numeric @@ -144,6 +144,7 @@ template */ +#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 index 22b0cf16cdc7..8dc1a136fdaf 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -158,7 +158,7 @@ template */ -#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 index 3587c359a46c..702f505d4f34 100644 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -134,6 +134,7 @@ template */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/queue b/libcxx/include/queue index b8b7ec46d956..d15c141920e8 100644 --- a/libcxx/include/queue +++ b/libcxx/include/queue @@ -220,6 +220,7 @@ template #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 index 0323c447618c..a2e1719b8621 100644 --- a/libcxx/include/random +++ b/libcxx/include/random @@ -1677,6 +1677,7 @@ class piecewise_linear_distribution } // 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 index b6c028d2219b..5be1614d3b11 100644 --- a/libcxx/include/ranges +++ b/libcxx/include/ranges @@ -230,6 +230,7 @@ namespace std { } */ +#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 index 07376bf8d713..5d7af88a2ac8 100644 --- a/libcxx/include/ratio +++ b/libcxx/include/ratio @@ -77,6 +77,7 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported } */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/regex b/libcxx/include/regex index 661a08b7c30c..456f34d45177 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -763,7 +763,7 @@ typedef regex_token_iterator wsregex_token_iterator; */ #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 index fe6d606ad14f..b505aad9dcf7 100644 --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -109,6 +109,7 @@ template */ +#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 index df7b0d921e1e..b174eba34dbc 100644 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -45,6 +45,7 @@ using binary_semaphore = counting_semaphore<1>; */ +#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 index 1ac86a1b26fd..a2d43cd883e3 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -473,7 +473,7 @@ erase_if(multiset& c, Predicate pred); // C++20 #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 index 95aa37806634..68a2bbae0f53 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -122,6 +122,7 @@ template */ +#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 index adb7d000488d..b96466550e8f 100644 --- a/libcxx/include/span +++ b/libcxx/include/span @@ -127,7 +127,7 @@ template */ -#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 index ba6148be8bd5..4ab3af74f05d 100644 --- a/libcxx/include/sstream +++ b/libcxx/include/sstream @@ -180,6 +180,7 @@ typedef basic_stringstream wstringstream; */ +#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 index 87d85c440a20..740589600164 100644 --- a/libcxx/include/stack +++ b/libcxx/include/stack @@ -98,6 +98,7 @@ template */ +#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 index 369f8b3d0825..0bc1aa8304ad 100644 --- 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 index f6dcf5ffeabf..ee5a296cd930 100644 --- a/libcxx/include/stdexcept +++ b/libcxx/include/stdexcept @@ -41,6 +41,7 @@ public: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf index abcdfe2e2fde..d76f6d0379ef 100644 --- a/libcxx/include/streambuf +++ b/libcxx/include/streambuf @@ -107,6 +107,7 @@ protected: */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/string b/libcxx/include/string index c79c0ed72abd..60b40c369b69 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -522,7 +522,7 @@ basic_string operator "" s( const char32_t *str, size_t len ); // C++1 #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 index 0b2456d93950..7c5d52b877d1 100644 --- 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 @@ namespace std { */ #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 index 1904bb773f7b..9ffdd9f84a31 100644 --- a/libcxx/include/strstream +++ b/libcxx/include/strstream @@ -129,6 +129,7 @@ private: */ +#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 index 48a6b2e503f1..feffa2debf4e 100644 --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -142,6 +142,7 @@ template <> struct hash; */ +#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 index 5a8e830fcca7..540f591f9d13 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -82,7 +82,7 @@ void sleep_for(const chrono::duration& rel_time); */ -#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 index ea7245d7aa88..0a62578eadbb 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -165,6 +165,7 @@ template */ +#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 index 0ecb0f97205b..952f5787baae 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -416,6 +416,8 @@ namespace std } */ + +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include #include diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex index f0680398e9a1..0b61f28b96eb 100644 --- a/libcxx/include/typeindex +++ b/libcxx/include/typeindex @@ -44,6 +44,7 @@ struct hash */ +#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 index 3d23458ef32f..a0ac527db782 100644 --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -56,6 +56,7 @@ public: */ +#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 index c701e67b2ef4..b7acfc3c8d00 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -515,7 +515,7 @@ template */ #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 index 0dd53a298ea6..f4ec9f5d5e1c 100644 --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -460,7 +460,7 @@ template */ #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 index ab19e2bc6f77..bcd4abfcd111 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -220,8 +220,8 @@ template */ +#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 index 8ceaafeb35bd..d79b0b21da06 100644 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -348,6 +348,7 @@ template unspecified2 end(const valarray& v); #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 index 3c68ab2cbc2b..6012aaad1f29 100644 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -199,6 +199,7 @@ namespace std { */ +#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 index ba4c1b439671..064a99d2f5de 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -279,7 +279,7 @@ erase_if(vector& c, Predicate pred); // C++20 #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 index 1fbba7ea7418..003a42cf59e6 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -193,6 +193,7 @@ __cpp_lib_void_t 201411L */ +#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 index 52dd7856e473..5ec5f12fc285 100644 --- 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 index 59b56d328a71..fda41a595bb2 100644 --- 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 index 2a0f26ab852d..5d6614114fbf 100644 --- 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 index 61ebb7b316bb..6a5c4e82163b 100644 --- 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 index 5be0997d6740..4e1cb9e06658 100644 --- 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 index 93d6d020cb1f..6fc8d1601aed 100644 --- 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 index 000000000000..0bdc30899b49 --- /dev/null +++ b/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp @@ -0,0 +1,769 @@ +//===----------------------------------------------------------------------===// +// +// 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. + +// We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime +// 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}} + +// The system-provided seems to be broken on AIX, which trips up this test. +// XFAIL: LIBCXX-AIX-FIXME + +/* +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) +# 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) +# 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) +# 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 index 4aefa89a9061..d3379352fbba 100644 --- a/libcxx/utils/CMakeLists.txt +++ b/libcxx/utils/CMakeLists.txt @@ -15,9 +15,14 @@ add_custom_target(libcxx-generate-private-header-tests 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 index 000000000000..7ef30bc146a1 --- /dev/null +++ b/libcxx/utils/generate_assertion_tests.py @@ -0,0 +1,135 @@ +#!/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)", + + "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)", + "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)", + + "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 index 14e5b4e44c58..191d0ee01cc9 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -937,6 +937,7 @@ def produce_version_header(): */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)