aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/src/support/runtime
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
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')
-rw-r--r--lib/libcxx/src/support/runtime/exception_fallback.ipp23
-rw-r--r--lib/libcxx/src/support/runtime/exception_msvc.ipp21
-rw-r--r--lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp4
-rw-r--r--lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp6
-rw-r--r--lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp4
-rw-r--r--lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp28
6 files changed, 36 insertions, 50 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 {}
diff --git a/lib/libcxx/src/support/runtime/exception_msvc.ipp b/lib/libcxx/src/support/runtime/exception_msvc.ipp
index 323cd9d180..2ae004bb02 100644
--- a/lib/libcxx/src/support/runtime/exception_msvc.ipp
+++ b/lib/libcxx/src/support/runtime/exception_msvc.ipp
@@ -11,8 +11,7 @@
# error this header can only be used when targeting the MSVC ABI
#endif
-#include <stdio.h>
-#include <stdlib.h>
+#include <__verbose_abort>
extern "C" {
typedef void(__cdecl* terminate_handler)();
@@ -32,7 +31,7 @@ unexpected_handler set_unexpected(unexpected_handler func) noexcept { return ::s
unexpected_handler get_unexpected() noexcept { return ::_get_unexpected(); }
-_LIBCPP_NORETURN void unexpected() {
+[[noreturn]] void unexpected() {
(*get_unexpected())();
// unexpected handler should not return
terminate();
@@ -42,21 +41,19 @@ terminate_handler set_terminate(terminate_handler func) noexcept { return ::set_
terminate_handler get_terminate() noexcept { return ::_get_terminate(); }
-_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; }
diff --git a/lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp b/lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
index bdb17b9996..8f5c2060bb 100644
--- a/lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
+++ b/lib/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
@@ -40,7 +40,7 @@ nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
nested_exception::~nested_exception() noexcept {}
-_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+void nested_exception::rethrow_nested() const {
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
@@ -55,7 +55,7 @@ exception_ptr current_exception() noexcept {
return ptr;
}
-_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+void rethrow_exception(exception_ptr p) {
__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
diff --git a/lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp b/lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
index 6dad248f9e..174b44ce0e 100644
--- a/lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
+++ b/lib/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
@@ -31,7 +31,7 @@ struct exception_ptr {
} // namespace __exception_ptr
-_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
+[[noreturn]] void rethrow_exception(__exception_ptr::exception_ptr);
exception_ptr::~exception_ptr() noexcept { reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr(); }
@@ -55,13 +55,13 @@ exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
-_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+[[noreturn]] void nested_exception::rethrow_nested() const {
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
}
-_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+[[noreturn]] void rethrow_exception(exception_ptr p) {
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
}
diff --git a/lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp
index b87742b32d..2be5136176 100644
--- a/lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp
+++ b/lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp
@@ -61,13 +61,13 @@ exception_ptr current_exception() noexcept {
return __ret;
}
-_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
+[[noreturn]] void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
nested_exception::~nested_exception() noexcept {}
-_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+[[noreturn]] void nested_exception::rethrow_nested() const {
if (__ptr_ == nullptr)
terminate();
rethrow_exception(__ptr_);
diff --git a/lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp b/lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
index e12b0caf41..05a71ce34e 100644
--- a/lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
+++ b/lib/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
@@ -7,33 +7,28 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdlib.h>
+#include <__verbose_abort>
namespace std {
exception_ptr::~exception_ptr() noexcept {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
exception_ptr::exception_ptr(const exception_ptr& other) noexcept : __ptr_(other.__ptr_) {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
exception_ptr exception_ptr::__from_native_exception_pointer(void *__e) noexcept {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
@@ -44,10 +39,9 @@ nested_exception::~nested_exception() noexcept {}
#endif
-_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
+[[noreturn]] void nested_exception::rethrow_nested() const {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
#if 0
if (__ptr_ == nullptr)
terminate();
@@ -57,14 +51,12 @@ _LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
exception_ptr current_exception() noexcept {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
-_LIBCPP_NORETURN void rethrow_exception(exception_ptr p) {
+[[noreturn]] void rethrow_exception(exception_ptr p) {
#warning exception_ptr not yet implemented
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+ __libcpp_verbose_abort("exception_ptr not yet implemented\n");
}
} // namespace std