[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
This commit is contained in:
Louis Dionne 2022-07-25 13:43:47 -04:00
parent 4191d661c7
commit 507125af3d
23 changed files with 227 additions and 207 deletions

View File

@ -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 <version> // must include any libc++ header before defining the handler (C compatibility headers excluded)
#include <version> // 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<int> 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

View File

@ -637,6 +637,7 @@ set(files
__utility/transaction.h
__utility/unreachable.h
__variant/monostate.h
__verbose_abort
algorithm
any
array

View File

@ -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<bool>(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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'}

View File

@ -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'}

View File

@ -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'}

View File

@ -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'}

View File

@ -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'}

View File

@ -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'}

View File

@ -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)

View File

@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
#include <__assert>
#include <__config>
#include <__verbose_abort>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
@ -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.
{

View File

@ -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 <cassert>
bool handler_called = false;
void std::__libcpp_assertion_handler(char const*, ...) {
void std::__libcpp_verbose_abort(char const*, ...) {
handler_called = true;
}

View File

@ -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 <cassert>
bool handler_called = false;
void std::__libcpp_assertion_handler(char const*, ...) {
void std::__libcpp_verbose_abort(char const*, ...) {
handler_called = true;
}

View File

@ -19,7 +19,7 @@
#include <cassert>
bool handler_called = false;
void std::__libcpp_assertion_handler(char const*, ...) {
void std::__libcpp_verbose_abort(char const*, ...) {
handler_called = true;
}

View File

@ -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 <version> // 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}}
}

View File

@ -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}}

View File

@ -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 <algorithm>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_1
#if defined(TEST_1)
# include <any>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_2
#if defined(TEST_2)
# include <array>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_3
#if defined(TEST_3)
# include <atomic>
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 <barrier>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_5
#if defined(TEST_5)
# include <bit>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_6
#if defined(TEST_6)
# include <bitset>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_7
#if defined(TEST_7)
# include <cassert>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_8
#if defined(TEST_8)
# include <ccomplex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_9
#if defined(TEST_9)
# include <cctype>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_10
#if defined(TEST_10)
# include <cerrno>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_11
#if defined(TEST_11)
# include <cfenv>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_12
#if defined(TEST_12)
# include <cfloat>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_13
#if defined(TEST_13)
# include <charconv>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_14
#if defined(TEST_14)
# include <chrono>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_15
#if defined(TEST_15)
# include <cinttypes>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_16
#if defined(TEST_16)
# include <ciso646>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_17
#if defined(TEST_17)
# include <climits>
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 <clocale>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_19
#if defined(TEST_19)
# include <cmath>
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 <codecvt>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_21
#if defined(TEST_21)
# include <compare>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_22
#if defined(TEST_22)
# include <complex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_24
#if defined(TEST_24)
# include <concepts>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_25
#if defined(TEST_25)
# include <condition_variable>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_26
#if defined(TEST_26)
# include <coroutine>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_27
#if defined(TEST_27)
# include <csetjmp>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_28
#if defined(TEST_28)
# include <csignal>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_29
#if defined(TEST_29)
# include <cstdarg>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_30
#if defined(TEST_30)
# include <cstdbool>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_31
#if defined(TEST_31)
# include <cstddef>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_32
#if defined(TEST_32)
# include <cstdint>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_33
#if defined(TEST_33)
# include <cstdio>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_34
#if defined(TEST_34)
# include <cstdlib>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_35
#if defined(TEST_35)
# include <cstring>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_36
#if defined(TEST_36)
# include <ctgmath>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_37
#if defined(TEST_37)
# include <ctime>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_39
#if defined(TEST_39)
# include <cuchar>
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 <cwchar>
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 <cwctype>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_42
#if defined(TEST_42)
# include <deque>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_44
#if defined(TEST_44)
# include <exception>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_45
#if defined(TEST_45)
# include <execution>
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 <filesystem>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_49
#if defined(TEST_49)
# include <format>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_50
#if defined(TEST_50)
# include <forward_list>
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 <fstream>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_52
#if defined(TEST_52)
# include <functional>
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 <future>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_54
#if defined(TEST_54)
# include <initializer_list>
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 <iomanip>
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 <ios>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_58
#if defined(TEST_58)
# include <iosfwd>
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 <iostream>
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 <istream>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_61
#if defined(TEST_61)
# include <iterator>
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 <latch>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_63
#if defined(TEST_63)
# include <limits>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_65
#if defined(TEST_65)
# include <list>
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 <locale>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_68
#if defined(TEST_68)
# include <map>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_70
#if defined(TEST_70)
# include <memory>
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 <mutex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_72
#if defined(TEST_72)
# include <new>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_73
#if defined(TEST_73)
# include <numbers>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_74
#if defined(TEST_74)
# include <numeric>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_75
#if defined(TEST_75)
# include <optional>
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 <ostream>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_77
#if defined(TEST_77)
# include <queue>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_78
#if defined(TEST_78)
# include <random>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_79
#if defined(TEST_79)
# include <ranges>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_80
#if defined(TEST_80)
# include <ratio>
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 <regex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_82
#if defined(TEST_82)
# include <scoped_allocator>
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 <semaphore>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_84
#if defined(TEST_84)
# include <set>
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 <shared_mutex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_87
#if defined(TEST_87)
# include <span>
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 <sstream>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_89
#if defined(TEST_89)
# include <stack>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_93
#if defined(TEST_93)
# include <stdexcept>
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 <streambuf>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_98
#if defined(TEST_98)
# include <string>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_100
#if defined(TEST_100)
# include <string_view>
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 <strstream>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_102
#if defined(TEST_102)
# include <system_error>
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 <thread>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_105
#if defined(TEST_105)
# include <tuple>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_106
#if defined(TEST_106)
# include <type_traits>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_107
#if defined(TEST_107)
# include <typeindex>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_108
#if defined(TEST_108)
# include <typeinfo>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_110
#if defined(TEST_110)
# include <unordered_map>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_111
#if defined(TEST_111)
# include <unordered_set>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_112
#if defined(TEST_112)
# include <utility>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_113
#if defined(TEST_113)
# include <valarray>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_114
#if defined(TEST_114)
# include <variant>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_115
#if defined(TEST_115)
# include <vector>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_116
#if defined(TEST_116)
# include <version>
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 <experimental/algorithm>
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 <experimental/coroutine>
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 <experimental/deque>
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 <experimental/forward_list>
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 <experimental/functional>
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 <experimental/iterator>
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 <experimental/list>
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 <experimental/map>
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 <experimental/memory_resource>
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 <experimental/propagate_const>
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 <experimental/regex>
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 <experimental/set>
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 <experimental/simd>
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 <experimental/string>
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 <experimental/type_traits>
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 <experimental/unordered_map>
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 <experimental/unordered_set>
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 <experimental/utility>
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 <experimental/vector>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_138
#if defined(TEST_138)
# include <ext/hash_map>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// RUN: %{build} -DTEST_139
#if defined(TEST_139)
# include <ext/hash_set>
using HandlerType = decltype(std::__libcpp_assertion_handler);
using HandlerType = decltype(std::__libcpp_verbose_abort);
#endif
// GENERATED-MARKER

View File

@ -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

View File

@ -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)