Skip to content

Commit b99a598

Browse files
author
Doug Wyatt
committed
Make __libcpp_verbose_abort() noexcept (it is already noreturn), to
match std::terminate(). Clang's function effect analysis can use this to ignore such functions as being beyond its scope.
1 parent 394f59c commit b99a598

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

libcxx/docs/ReleaseNotes/20.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ Deprecations and Removals
7777
supported as an extension anymore, please migrate any code that uses e.g. ``std::vector<const T>`` to be
7878
standards conforming.
7979

80+
- The function ``__libcpp_verbose_abort()`` is now ``noexcept``, to match ``std::terminate()``. (The combination of
81+
``noexcept`` and ``[[noreturn]]`` has special significance for function effects analysis.)
82+
8083
Upcoming Deprecations and Removals
8184
----------------------------------
8285

libcxx/include/__verbose_abort

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
// This function should never be called directly from the code -- it should only be called through
2222
// the _LIBCPP_VERBOSE_ABORT macro.
2323
[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
24-
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
24+
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT;
2525

2626
// _LIBCPP_VERBOSE_ABORT(format, args...)
2727
//

libcxx/src/verbose_abort.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern "C" void android_set_abort_message(const char* msg);
2828

2929
_LIBCPP_BEGIN_NAMESPACE_STD
3030

31-
_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) {
31+
_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept {
3232
// Write message to stderr. We do this before formatting into a
3333
// buffer so that we still get some information out if that fails.
3434
{

libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#include <__verbose_abort>
1616
#include <cstdlib>
1717

18-
void std::__libcpp_verbose_abort(char const*, ...) {
19-
std::exit(EXIT_SUCCESS);
20-
}
18+
void std::__libcpp_verbose_abort(char const*, ...) noexcept { std::exit(EXIT_SUCCESS); }
2119

2220
int main(int, char**) {
2321
std::__libcpp_verbose_abort("%s", "message");

libcxx/test/support/check_assertion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class DeathTest {
334334
};
335335

336336
#ifdef _LIBCPP_VERSION
337-
void std::__libcpp_verbose_abort(char const* format, ...) {
337+
void std::__libcpp_verbose_abort(char const* format, ...) noexcept {
338338
va_list args;
339339
va_start(args, format);
340340

0 commit comments

Comments
 (0)