aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/src/support/runtime/exception_fallback.ipp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-04-05 01:46:13 -0400
committerGitHub <noreply@github.com>2025-04-05 01:46:13 -0400
commit0cd31fc7ff157551cfbba5da35cd79f118d2a2e3 (patch)
treea308488f5d85184c8ec402fb3f55f1cf2704443e /lib/libcxx/src/support/runtime/exception_fallback.ipp
parent8acedfd5baabab705946ad097746f9183ef62420 (diff)
parentcefe65c1b8abe65a22d4b68410db1be264fdeda0 (diff)
downloadzig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.tar.gz
zig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.zip
Merge pull request #22780 from ziglang/llvm20
LLVM 20
Diffstat (limited to 'lib/libcxx/src/support/runtime/exception_fallback.ipp')
-rw-r--r--lib/libcxx/src/support/runtime/exception_fallback.ipp23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/libcxx/src/support/runtime/exception_fallback.ipp b/lib/libcxx/src/support/runtime/exception_fallback.ipp
index 18ff4b83d8..ba283aee22 100644
--- a/lib/libcxx/src/support/runtime/exception_fallback.ipp
+++ b/lib/libcxx/src/support/runtime/exception_fallback.ipp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include <cstdio>
+#include <__verbose_abort>
namespace std {
@@ -21,7 +21,7 @@ unexpected_handler set_unexpected(unexpected_handler func) noexcept {
unexpected_handler get_unexpected() noexcept { return __libcpp_atomic_load(&__unexpected_handler); }
-_LIBCPP_NORETURN void unexpected() {
+[[noreturn]] void unexpected() {
(*get_unexpected())();
// unexpected handler should not return
terminate();
@@ -33,29 +33,26 @@ terminate_handler set_terminate(terminate_handler func) noexcept {
terminate_handler get_terminate() noexcept { return __libcpp_atomic_load(&__terminate_handler); }
-_LIBCPP_NORETURN void terminate() noexcept {
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+[[noreturn]] void terminate() noexcept {
+#if _LIBCPP_HAS_EXCEPTIONS
try {
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+#endif // _LIBCPP_HAS_EXCEPTIONS
(*get_terminate())();
// handler should not return
- fprintf(stderr, "terminate_handler unexpectedly returned\n");
- ::abort();
-#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ __libcpp_verbose_abort("terminate_handler unexpectedly returned\n");
+#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
// handler should not throw exception
- fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
- ::abort();
+ __libcpp_verbose_abort("terminate_handler unexpectedly threw an exception\n");
}
-#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+#endif // _LIBCPP_HAS_EXCEPTIONS
}
bool uncaught_exception() noexcept { return uncaught_exceptions() > 0; }
int uncaught_exceptions() noexcept {
#warning uncaught_exception not yet implemented
- fprintf(stderr, "uncaught_exceptions not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("uncaught_exceptions not yet implemented\n");
}
exception::~exception() noexcept {}