From 507125af3d0b953cb56bce2e5b8000249fe1ef53 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Mon, 25 Jul 2022 13:43:47 -0400 Subject: [PATCH] [libc++] Rename __libcpp_assertion_handler to __libcpp_verbose_abort With the goal of reusing that handler to do other things besides handling assertions (such as terminating when an exception is thrown under -fno-exceptions), the name `__libcpp_assertion_handler` doesn't really make sense anymore. Furthermore, I didn't want to use the name `__libcpp_abort_handler`, since that would give the impression that the handler is called whenever `std::abort()` is called, which is not the case at all. Differential Revision: https://reviews.llvm.org/D130562 --- libcxx/docs/UsingLibcxx.rst | 57 ++-- libcxx/include/CMakeLists.txt | 1 + libcxx/include/__assert | 11 +- libcxx/include/__availability | 41 ++- libcxx/include/__verbose_abort | 27 ++ libcxx/include/module.modulemap.in | 1 + libcxx/lib/abi/CHANGELOG.TXT | 4 +- ...bcxxabi.v1.stable.exceptions.nonew.abilist | 2 +- ...bcxxabi.v1.stable.exceptions.nonew.abilist | 2 +- ...bcxxabi.v1.stable.exceptions.nonew.abilist | 2 +- ...bcxxabi.v1.stable.exceptions.nonew.abilist | 2 +- ...bcxxabi.v1.stable.exceptions.nonew.abilist | 2 +- ...xxabi.v1.stable.noexceptions.nonew.abilist | 2 +- libcxx/src/CMakeLists.txt | 2 +- libcxx/src/{assert.cpp => verbose_abort.cpp} | 4 +- ...ize_verbose_abort.backdeployment.pass.cpp} | 6 +- ...s.cpp => customize_verbose_abort.pass.cpp} | 6 +- .../debug_mode_compatibility.pass.cpp | 2 +- ...ult_verbose_abort.availability.verify.cpp} | 6 +- ...ass.cpp => default_verbose_abort.pass.cpp} | 4 +- ...p => headers_declare_verbose_abort.sh.cpp} | 244 +++++++++--------- libcxx/test/support/check_assertion.h | 2 +- libcxx/utils/generate_header_tests.py | 4 +- 23 files changed, 227 insertions(+), 207 deletions(-) create mode 100644 libcxx/include/__verbose_abort rename libcxx/src/{assert.cpp => verbose_abort.cpp} (96%) rename libcxx/test/libcxx/assertions/{customize_handler.backdeployment.pass.cpp => customize_verbose_abort.backdeployment.pass.cpp} (82%) rename libcxx/test/libcxx/assertions/{customize_handler.pass.cpp => customize_verbose_abort.pass.cpp} (77%) rename libcxx/test/libcxx/assertions/{default_handler.availability.verify.cpp => default_verbose_abort.availability.verify.cpp} (79%) rename libcxx/test/libcxx/assertions/{default_handler.abort.pass.cpp => default_verbose_abort.pass.cpp} (83%) rename libcxx/test/libcxx/assertions/{headers_declare_assertion_handler.sh.cpp => headers_declare_verbose_abort.sh.cpp} (60%) diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst index 1a3d2f3e5319..d4f86ff397af 100644 --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -152,18 +152,18 @@ where the static or shared library was compiled **with** assertions but the user disable them). However, most of the code in libc++ is in the headers, so the user-selected value for ``_LIBCPP_ENABLE_ASSERTIONS`` (if any) will usually be respected. -When an assertion fails, an assertion handler function is called. The library provides a default -assertion handler that prints an error message and calls ``std::abort()``. Note that this assertion -handler is provided by the static or shared library, so it is only available when deploying to a -platform where the compiled library is sufficiently recent. However, users can also override that -assertion handler with their own, which can be useful to provide custom behavior, or when deploying -to older platforms where the default assertion handler isn't available. +When an assertion fails, the program is aborted through a special verbose termination function. The +library provides a default function that prints an error message and calls ``std::abort()``. Note +that this function is provided by the static or shared library, so it is only available when deploying +to a platform where the compiled library is sufficiently recent. However, users can also override that +function with their own, which can be useful to provide custom behavior, or when deploying to older +platforms where the default function isn't available. -Replacing the default assertion handler is done by defining the following function: +Replacing the default verbose termination function is done by defining the following function: .. code-block:: cpp - void __libcpp_assertion_handler(char const* format, ...) + void __libcpp_verbose_abort(char const* format, ...) This mechanism is similar to how one can replace the default definition of ``operator new`` and ``operator delete``. For example: @@ -171,9 +171,9 @@ and ``operator delete``. For example: .. code-block:: cpp // In HelloWorldHandler.cpp - #include // must include any libc++ header before defining the handler (C compatibility headers excluded) + #include // must include any libc++ header before defining the function (C compatibility headers excluded) - void std::__libcpp_assertion_handler(char const* format, ...) { + void std::__libcpp_verbose_abort(char const* format, ...) { va_list list; va_start(list, format); std::vfprintf(stderr, format, list); @@ -187,30 +187,29 @@ and ``operator delete``. For example: int main() { std::vector v; - int& x = v[0]; // Your assertion handler will be called here if _LIBCPP_ENABLE_ASSERTIONS=1 + int& x = v[0]; // Your termination function will be called here if _LIBCPP_ENABLE_ASSERTIONS=1 } -Also note that the assertion handler should usually not return. Since the assertions in libc++ -catch undefined behavior, your code will proceed with undefined behavior if your assertion -handler is called and does return. +Also note that the verbose termination function should never return. Since assertions in libc++ +catch undefined behavior, your code will proceed with undefined behavior if your function is called +and does return. -Furthermore, throwing an exception from the assertion handler is not recommended. Indeed, many -functions in the library are ``noexcept``, and any exception thrown from the assertion handler -will result in ``std::terminate`` being called. +Furthermore, exceptions should not be thrown from the function. Indeed, many functions in the +library are ``noexcept``, and any exception thrown from the termination function will result +in ``std::terminate`` being called. -Back-deploying with a custom assertion handler ----------------------------------------------- -When deploying to an older platform that does not provide a default assertion handler, the -compiler will diagnose the usage of ``std::__libcpp_assertion_handler`` with an error. This -is done to avoid the load-time error that would otherwise happen if the code was being deployed -on the older system. +Back-deploying with a custom verbose termination function +--------------------------------------------------------- +When deploying to an older platform that does not provide a default verbose termination function, +the compiler will diagnose the usage of ``std::__libcpp_verbose_abort`` with an error. This is done +to avoid the load-time error that would otherwise happen if the code was being deployed on older +systems. -If you are providing a custom assertion handler, this error is effectively a false positive. -To let the library know that you are providing a custom assertion handler in back-deployment -scenarios, you must define the ``_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED`` macro, -and the library will assume that you are providing your own definition. If no definition is -provided and the code is back-deployed to the older platform, it will fail to load when the -dynamic linker fails to find a definition for ``std::__libcpp_assertion_handler``, so you +If you are providing a custom verbose termination function, this error is effectively a false positive. +To let the library know that you are providing a custom function in back-deployment scenarios, you must +define the ``_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED`` macro, and the library will assume that +you are providing your own definition. If no definition is provided and the code is back-deployed to an older +platform, it will fail to load when the dynamic linker fails to find a definition of the function, so you should only remove the guard rails if you really mean it! Libc++ Configuration Macros diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 36eb70d39d76..1193f680c4fe 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -637,6 +637,7 @@ set(files __utility/transaction.h __utility/unreachable.h __variant/monostate.h + __verbose_abort algorithm any array diff --git a/libcxx/include/__assert b/libcxx/include/__assert index 82db2cf052b5..87556085eabb 100644 --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -10,8 +10,8 @@ #ifndef _LIBCPP___ASSERT #define _LIBCPP___ASSERT -#include <__availability> #include <__config> +#include <__verbose_abort> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -45,7 +45,7 @@ # define _LIBCPP_ASSERT(expression, message) \ (__builtin_expect(static_cast(expression), 1) ? \ (void)0 : \ - ::std::__libcpp_assertion_handler("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)) + ::std::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)) #elif !defined(_LIBCPP_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume) # define _LIBCPP_ASSERT(expression, message) \ (_LIBCPP_DIAGNOSTIC_PUSH \ @@ -56,11 +56,4 @@ # define _LIBCPP_ASSERT(expression, message) ((void)0) #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ASSERTION_HANDLER _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) -void __libcpp_assertion_handler(const char *__format, ...); - -_LIBCPP_END_NAMESPACE_STD - #endif // _LIBCPP___ASSERT diff --git a/libcxx/include/__availability b/libcxx/include/__availability index f9d824509f3d..d64bde125338 100644 --- a/libcxx/include/__availability +++ b/libcxx/include/__availability @@ -156,22 +156,21 @@ # define _LIBCPP_AVAILABILITY_FORMAT // # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format - // This controls whether the std::__libcpp_assertion_handler default - // assertion handler is provided by the library. + // This controls whether the default verbose termination function is + // provided by the library. // - // Note that when users provide their own custom assertion handler, - // it doesn't matter whether the dylib provides a default handler, - // and the availability markup can actually give a false positive - // diagnostic (it will think that no handler is provided, when in - // reality the user has provided their own). + // Note that when users provide their own custom function, it doesn't + // matter whether the dylib provides a default function, and the + // availability markup can actually give a false positive diagnostic + // (it will think that no function is provided, when in reality the + // user has provided their own). // - // Users can pass -D_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED + // Users can pass -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED // to the compiler to tell the library to ignore the fact that the - // default handler isn't available on their deployment target. Note that - // defining this macro but failing to define a custom assertion handler - // will lead to a load-time error on back-deployment targets, so it - // should be avoided. -# define _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER + // default function isn't available on their deployment target. Note that + // defining this macro but failing to define a custom function will lead to + // a load-time error on back-deployment targets, so it should be avoided. +# define _LIBCPP_AVAILABILITY_DEFAULT_VERBOSE_ABORT #elif defined(__APPLE__) @@ -272,7 +271,7 @@ __attribute__((unavailable)) # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format -# define _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER \ +# define _LIBCPP_AVAILABILITY_DEFAULT_VERBOSE_ABORT \ __attribute__((unavailable)) #else @@ -297,14 +296,14 @@ # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS #endif -// Define the special assertion handler availability attribute, which can be silenced by -// users if they provide their own custom assertion handler. The rest of the code should -// not use the *_DEFAULT_* macro directly, since that would make it ignore the fact that -// the user provided a custom handler. -#if defined(_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED) -# define _LIBCPP_AVAILABILITY_ASSERTION_HANDLER /* nothing */ +// Define the special verbose termination function availability attribute, which can be silenced by +// users if they provide their own custom function. The rest of the code should not use the +// *_DEFAULT_* macro directly, since that would make it ignore the fact that the user provided +// a custom function. +#if defined(_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) +# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT /* nothing */ #else -# define _LIBCPP_AVAILABILITY_ASSERTION_HANDLER _LIBCPP_AVAILABILITY_DEFAULT_ASSERTION_HANDLER +# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_AVAILABILITY_DEFAULT_VERBOSE_ABORT #endif #endif // _LIBCPP___AVAILABILITY diff --git a/libcxx/include/__verbose_abort b/libcxx/include/__verbose_abort new file mode 100644 index 000000000000..489047c74cc4 --- /dev/null +++ b/libcxx/include/__verbose_abort @@ -0,0 +1,27 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___VERBOSE_ABORT +#define _LIBCPP___VERBOSE_ABORT + +#include <__availability> +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) +void __libcpp_verbose_abort(const char *__format, ...); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___VERBOSE_ABORT diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index 88f4d152063b..8777db3e72db 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -1294,6 +1294,7 @@ module std [system] { module __tree { header "__tree" export * } module __tuple { private header "__tuple" export * } module __undef_macros { header "__undef_macros" export * } + module __verbose_abort { header "__verbose_abort" export * } module experimental { requires cplusplus11 diff --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT index 32080320cbc0..5e65e943c6e9 100644 --- a/libcxx/lib/abi/CHANGELOG.TXT +++ b/libcxx/lib/abi/CHANGELOG.TXT @@ -64,7 +64,7 @@ Version 15.0 Symbol removed: _ZTSNSt3__18__c_nodeE Symbol removed: _ZTVNSt3__18__c_nodeE -* b0fd9497af6d and 7de5aca84c54 - [libc++] Add a lightweight overridable assertion handler +* b0fd9497af6d, 7de5aca84c54 and XXXXXXXX - [libc++] Add a lightweight overridable assertion handler This patch adds a lightweight assertion handler mechanism that can be overriden at link-time in a fashion similar to `operator new`. A default @@ -73,7 +73,7 @@ Version 15.0 All platforms ------------- - Symbol added: _ZNSt3__126__libcpp_assertion_handlerEPKcz + Symbol added: _ZNSt3__122__libcpp_verbose_abortEPKcz ------------ Version 14.0 diff --git a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist index dd2438dfcb43..50cbe4c2b013 100644 --- a/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/arm64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1534,7 +1534,7 @@ {'is_defined': True, 'name': '__ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIxNS_22__cxx_atomic_base_implIxEEEE', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__123__libcpp_atomic_monitorEPVKv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE', 'type': 'FUNC'} -{'is_defined': True, 'name': '__ZNSt3__126__libcpp_assertion_handlerEPKcz', 'type': 'FUNC'} +{'is_defined': True, 'name': '__ZNSt3__122__libcpp_verbose_abortEPKcz', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist index c662644418d4..56ec7aaa171d 100644 --- a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1678,7 +1678,7 @@ {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__119basic_istringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} -{'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__126__libcpp_assertion_handlerEPKcz', 'storage_mapping_class': 'DS', 'type': 'FUNC'} +{'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__122__libcpp_verbose_abortEPKcz', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist index d730eaeb776e..9d30600440bd 100644 --- a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1678,7 +1678,7 @@ {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__119basic_istringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEaSEOS5_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} -{'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__126__libcpp_assertion_handlerEPKcz', 'storage_mapping_class': 'DS', 'type': 'FUNC'} +{'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__122__libcpp_verbose_abortEPKcz', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} {'import_export': 'wEXP', 'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'storage_mapping_class': 'DS', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist index bc81e61c55e2..d0e8b7347172 100644 --- a/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-apple-darwin.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1534,7 +1534,7 @@ {'is_defined': True, 'name': '__ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIxNS_22__cxx_atomic_base_implIxEEEE', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__123__libcpp_atomic_monitorEPVKv', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE', 'type': 'FUNC'} -{'is_defined': True, 'name': '__ZNSt3__126__libcpp_assertion_handlerEPKcz', 'type': 'FUNC'} +{'is_defined': True, 'name': '__ZNSt3__122__libcpp_verbose_abortEPKcz', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist index 1437c1cc4b73..8de5a0b4da94 100644 --- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist @@ -1225,7 +1225,7 @@ {'is_defined': True, 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE', 'type': 'FUNC'} -{'is_defined': True, 'name': '_ZNSt3__126__libcpp_assertion_handlerEPKcz', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt3__122__libcpp_verbose_abortEPKcz', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'type': 'FUNC'} diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist index 1348fc6ca303..90d9a665a1c7 100644 --- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist +++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist @@ -1197,7 +1197,7 @@ {'is_defined': True, 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKv', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE', 'type': 'FUNC'} -{'is_defined': True, 'name': '_ZNSt3__126__libcpp_assertion_handlerEPKcz', 'type': 'FUNC'} +{'is_defined': True, 'name': '_ZNSt3__122__libcpp_verbose_abortEPKcz', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_', 'type': 'FUNC'} {'is_defined': True, 'name': '_ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIddEEPdEEbT0_S5_T_', 'type': 'FUNC'} diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index f7d2896d10f3..61c60f934599 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -4,7 +4,6 @@ set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTOR set(LIBCXX_SOURCES algorithm.cpp any.cpp - assert.cpp atomic.cpp barrier.cpp bind.cpp @@ -62,6 +61,7 @@ set(LIBCXX_SOURCES valarray.cpp variant.cpp vector.cpp + verbose_abort.cpp ) if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS) diff --git a/libcxx/src/assert.cpp b/libcxx/src/verbose_abort.cpp similarity index 96% rename from libcxx/src/assert.cpp rename to libcxx/src/verbose_abort.cpp index d6e96f255e35..a9fba5e3c007 100644 --- a/libcxx/src/assert.cpp +++ b/libcxx/src/verbose_abort.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include <__assert> #include <__config> +#include <__verbose_abort> #include #include #include @@ -29,7 +29,7 @@ extern "C" void android_set_abort_message(const char* msg); _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_WEAK -void __libcpp_assertion_handler(char const* format, ...) { +void __libcpp_verbose_abort(char const* format, ...) { // Write message to stderr. We do this before formatting into a // buffer so that we still get some information out if that fails. { diff --git a/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.backdeployment.pass.cpp similarity index 82% rename from libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp rename to libcxx/test/libcxx/assertions/customize_verbose_abort.backdeployment.pass.cpp index b1b5e0c8b1b6..45f92bc83a26 100644 --- a/libcxx/test/libcxx/assertions/customize_handler.backdeployment.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.backdeployment.pass.cpp @@ -7,17 +7,17 @@ //===----------------------------------------------------------------------===// // Make sure that we can enable assertions when we back-deploy to older platforms -// if we define _LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED. +// if we define _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED. // // Note that this test isn't really different from customize_handler.pass.cpp when // run outside of back-deployment scenarios, but we still run it all the time. -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_ASSERTION_HANDLER_PROVIDED +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED #include bool handler_called = false; -void std::__libcpp_assertion_handler(char const*, ...) { +void std::__libcpp_verbose_abort(char const*, ...) { handler_called = true; } diff --git a/libcxx/test/libcxx/assertions/customize_handler.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.pass.cpp similarity index 77% rename from libcxx/test/libcxx/assertions/customize_handler.pass.cpp rename to libcxx/test/libcxx/assertions/customize_verbose_abort.pass.cpp index e6faf1b914b9..7f956742bbe7 100644 --- a/libcxx/test/libcxx/assertions/customize_handler.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.pass.cpp @@ -6,18 +6,18 @@ // //===----------------------------------------------------------------------===// -// Test that we can set a custom assertion handler. +// Test that we can set a custom verbose termination function. // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -// We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime +// We flag uses of the verbose termination function in older dylibs at compile-time to avoid runtime // failures when back-deploying. // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}} #include bool handler_called = false; -void std::__libcpp_assertion_handler(char const*, ...) { +void std::__libcpp_verbose_abort(char const*, ...) { handler_called = true; } diff --git a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp b/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp index 6cee46ae7a6f..b1dd54cbacd1 100644 --- a/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp +++ b/libcxx/test/libcxx/assertions/debug_mode_compatibility.pass.cpp @@ -19,7 +19,7 @@ #include bool handler_called = false; -void std::__libcpp_assertion_handler(char const*, ...) { +void std::__libcpp_verbose_abort(char const*, ...) { handler_called = true; } diff --git a/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp b/libcxx/test/libcxx/assertions/default_verbose_abort.availability.verify.cpp similarity index 79% rename from libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp rename to libcxx/test/libcxx/assertions/default_verbose_abort.availability.verify.cpp index 6fc8d1601aed..932fc2435439 100644 --- a/libcxx/test/libcxx/assertions/default_handler.availability.verify.cpp +++ b/libcxx/test/libcxx/assertions/default_verbose_abort.availability.verify.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -// Make sure that we diagnose any usage of the default assertion handler on a platform -// that doesn't support it at compile-time. +// Make sure that we diagnose any usage of the default verbose termination function +// on a platform that doesn't support it at compile-time. // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 @@ -16,5 +16,5 @@ #include // any header would work void f() { - _LIBCPP_ASSERT(true, "message"); // expected-error {{'__libcpp_assertion_handler' is unavailable}} + _LIBCPP_ASSERT(true, "message"); // expected-error {{'__libcpp_verbose_abort' is unavailable}} } diff --git a/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp similarity index 83% rename from libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp rename to libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp index 4c0390d07790..1b4e3615a7be 100644 --- a/libcxx/test/libcxx/assertions/default_handler.abort.pass.cpp +++ b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp @@ -6,11 +6,11 @@ // //===----------------------------------------------------------------------===// -// Test that the default assertion handler aborts the program. +// Test that the default verbose termination function aborts the program. // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1 -// We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime +// We flag uses of the verbose termination function in older dylibs at compile-time to avoid runtime // failures when back-deploying. // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}} diff --git a/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp similarity index 60% rename from libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp rename to libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp index 8c8be13b56b9..e659732f743f 100644 --- a/libcxx/test/libcxx/assertions/headers_declare_assertion_handler.sh.cpp +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -// Test that all public C++ headers define the assertion handler. +// Test that all public C++ headers define the verbose termination function. -// We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime +// We flag uses of the verbose termination function in older dylibs at compile-time to avoid runtime // failures when back-deploying. // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}} @@ -34,7 +34,7 @@ for i, header in enumerate(public_headers): // {run}: %{{build}} -DTEST_{i} #if defined(TEST_{i}){restrictions} # include <{header}> - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif """.format(**vars)) @@ -55,715 +55,715 @@ int main(int, char**) { return 0; } // RUN: %{build} -DTEST_0 #if defined(TEST_0) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_1 #if defined(TEST_1) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_2 #if defined(TEST_2) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_3 #if defined(TEST_3) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_4 #if defined(TEST_4) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_5 #if defined(TEST_5) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_6 #if defined(TEST_6) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_7 #if defined(TEST_7) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_8 #if defined(TEST_8) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_9 #if defined(TEST_9) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_10 #if defined(TEST_10) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_11 #if defined(TEST_11) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_12 #if defined(TEST_12) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_13 #if defined(TEST_13) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_14 #if defined(TEST_14) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_15 #if defined(TEST_15) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_16 #if defined(TEST_16) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_17 #if defined(TEST_17) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_18 #if defined(TEST_18) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_19 #if defined(TEST_19) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_20 #if defined(TEST_20) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_21 #if defined(TEST_21) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_22 #if defined(TEST_22) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_24 #if defined(TEST_24) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_25 #if defined(TEST_25) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_26 #if defined(TEST_26) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_27 #if defined(TEST_27) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_28 #if defined(TEST_28) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_29 #if defined(TEST_29) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_30 #if defined(TEST_30) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_31 #if defined(TEST_31) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_32 #if defined(TEST_32) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_33 #if defined(TEST_33) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_34 #if defined(TEST_34) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_35 #if defined(TEST_35) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_36 #if defined(TEST_36) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_37 #if defined(TEST_37) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_39 #if defined(TEST_39) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_40 #if defined(TEST_40) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_41 #if defined(TEST_41) && !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_42 #if defined(TEST_42) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_44 #if defined(TEST_44) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_45 #if defined(TEST_45) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_47 #if defined(TEST_47) && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_49 #if defined(TEST_49) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_50 #if defined(TEST_50) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_51 #if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_52 #if defined(TEST_52) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_53 #if defined(TEST_53) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_54 #if defined(TEST_54) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_56 #if defined(TEST_56) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_57 #if defined(TEST_57) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_58 #if defined(TEST_58) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_59 #if defined(TEST_59) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_60 #if defined(TEST_60) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_61 #if defined(TEST_61) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_62 #if defined(TEST_62) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_63 #if defined(TEST_63) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_65 #if defined(TEST_65) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_66 #if defined(TEST_66) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_68 #if defined(TEST_68) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_70 #if defined(TEST_70) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_71 #if defined(TEST_71) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_72 #if defined(TEST_72) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_73 #if defined(TEST_73) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_74 #if defined(TEST_74) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_75 #if defined(TEST_75) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_76 #if defined(TEST_76) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_77 #if defined(TEST_77) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_78 #if defined(TEST_78) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_79 #if defined(TEST_79) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_80 #if defined(TEST_80) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_81 #if defined(TEST_81) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_82 #if defined(TEST_82) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_83 #if defined(TEST_83) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_84 #if defined(TEST_84) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_86 #if defined(TEST_86) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_87 #if defined(TEST_87) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_88 #if defined(TEST_88) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_89 #if defined(TEST_89) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_93 #if defined(TEST_93) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_97 #if defined(TEST_97) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_98 #if defined(TEST_98) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_100 #if defined(TEST_100) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_101 #if defined(TEST_101) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_102 #if defined(TEST_102) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_104 #if defined(TEST_104) && !defined(_LIBCPP_HAS_NO_THREADS) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_105 #if defined(TEST_105) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_106 #if defined(TEST_106) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_107 #if defined(TEST_107) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_108 #if defined(TEST_108) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_110 #if defined(TEST_110) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_111 #if defined(TEST_111) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_112 #if defined(TEST_112) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_113 #if defined(TEST_113) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_114 #if defined(TEST_114) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_115 #if defined(TEST_115) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_116 #if defined(TEST_116) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_119 #if defined(TEST_119) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_120 #if defined(TEST_120) && __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_121 #if defined(TEST_121) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_122 #if defined(TEST_122) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_123 #if defined(TEST_123) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_124 #if defined(TEST_124) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_125 #if defined(TEST_125) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_126 #if defined(TEST_126) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_127 #if defined(TEST_127) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_128 #if defined(TEST_128) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_129 #if defined(TEST_129) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_130 #if defined(TEST_130) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_131 #if defined(TEST_131) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_132 #if defined(TEST_132) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_133 #if defined(TEST_133) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_134 #if defined(TEST_134) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_135 #if defined(TEST_135) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_136 #if defined(TEST_136) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_137 #if defined(TEST_137) && __cplusplus >= 201103L # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_138 #if defined(TEST_138) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // RUN: %{build} -DTEST_139 #if defined(TEST_139) # include - using HandlerType = decltype(std::__libcpp_assertion_handler); + using HandlerType = decltype(std::__libcpp_verbose_abort); #endif // GENERATED-MARKER diff --git a/libcxx/test/support/check_assertion.h b/libcxx/test/support/check_assertion.h index 789823a6746a..2d1f7b89c436 100644 --- a/libcxx/test/support/check_assertion.h +++ b/libcxx/test/support/check_assertion.h @@ -236,7 +236,7 @@ private: std::string stderr_from_child_; }; -void std::__libcpp_assertion_handler(char const* format, ...) { +void std::__libcpp_verbose_abort(char const* format, ...) { assert(!GlobalMatcher().empty()); // Extract information from the error message. This has to stay synchronized with diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py index 0c2997450517..897e0228d067 100755 --- a/libcxx/utils/generate_header_tests.py +++ b/libcxx/utils/generate_header_tests.py @@ -64,7 +64,7 @@ header_restrictions = { private_headers_still_public_in_modules = [ '__assert', '__bsd_locale_defaults.h', '__bsd_locale_fallbacks.h', '__config', '__config_site.in', '__debug', '__hash_table', - '__threading_support', '__tree', '__undef_macros' + '__threading_support', '__tree', '__undef_macros', '__verbose_abort' ] def find_script(file): @@ -136,7 +136,7 @@ def main(): 'private_headers_still_public_in_modules': private_headers_still_public_in_modules } - produce(test.joinpath('libcxx/assertions/headers_declare_assertion_handler.sh.cpp'), variables) + produce(test.joinpath('libcxx/assertions/headers_declare_verbose_abort.sh.cpp'), variables) produce(test.joinpath('libcxx/clang_tidy.sh.cpp'), variables) produce(test.joinpath('libcxx/double_include.sh.cpp'), variables) produce(test.joinpath('libcxx/min_max_macros.compile.pass.cpp'), variables)