From 3cfa564ed7e6de4be323e2841193742ab9298a05 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Tue, 25 Nov 2025 13:41:57 +0100 Subject: [PATCH] [libc++] Annotate {set,get}_terminate to return non-null pointers --- libcxx/include/__exception/operations.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/include/__exception/operations.h b/libcxx/include/__exception/operations.h index 29d5c698a96db..d3021782e8660 100644 --- a/libcxx/include/__exception/operations.h +++ b/libcxx/include/__exception/operations.h @@ -25,8 +25,8 @@ _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT; #endif using terminate_handler = void (*)(); -_LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT; -_LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT; +[[__gnu__::__returns_nonnull__]] _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT; +[[__gnu__::__returns_nonnull__]] _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT; #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION) _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 bool uncaught_exception() _NOEXCEPT;