Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make __libcpp_verbose_abort() noexcept like std::terminate() #109151

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libcxx/docs/ReleaseNotes/20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ Deprecations and Removals
were private but could cause ambiguity in name lookup. Code that expects such ambiguity will possibly not compile in
LLVM 20.

- The function ``__libcpp_verbose_abort()`` is now ``noexcept``, to match ``std::terminate()``. (The combination of
``noexcept`` and ``[[noreturn]]`` has special significance for function effects analysis.)

Upcoming Deprecations and Removals
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__verbose_abort
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// This function should never be called directly from the code -- it should only be called through
// the _LIBCPP_VERBOSE_ABORT macro.
[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT;

// _LIBCPP_VERBOSE_ABORT(format, args...)
//
Expand Down
2 changes: 1 addition & 1 deletion libcxx/src/verbose_abort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" void android_set_abort_message(const char* msg);

_LIBCPP_BEGIN_NAMESPACE_STD

_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) {
_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept {
// Write message to stderr. We do this before formatting into a
// buffer so that we still get some information out if that fails.
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
#include <__verbose_abort>
#include <cstdlib>

void std::__libcpp_verbose_abort(char const*, ...) {
std::exit(EXIT_SUCCESS);
}
void std::__libcpp_verbose_abort(char const*, ...) _NOEXCEPT { std::exit(EXIT_SUCCESS); }

int main(int, char**) {
std::__libcpp_verbose_abort("%s", "message");
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/support/check_assertion.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class DeathTest {
};

#ifdef _LIBCPP_VERSION
void std::__libcpp_verbose_abort(char const* format, ...) {
void std::__libcpp_verbose_abort(char const* format, ...) noexcept {
va_list args;
va_start(args, format);

Expand Down
Loading