Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef _LIBCPP___EXCEPTION_OPERATIONS_H |
| 10 | #define _LIBCPP___EXCEPTION_OPERATIONS_H |
| 11 | |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 12 | #include <__config> |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 13 | |
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 15 | # pragma GCC system_header |
| 16 | #endif |
| 17 | |
| 18 | namespace std { // purposefully not using versioning namespace |
| 19 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ |
| 20 | defined(_LIBCPP_BUILDING_LIBRARY) |
| 21 | using unexpected_handler = void (*)(); |
Nikolas Klauser | f1ea0b1 | 2023-06-14 17:17:50 | [diff] [blame] | 22 | _LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; |
| 23 | _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT; |
Nikolas Klauser | 748023dc | 2024-09-11 06:59:46 | [diff] [blame] | 24 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void unexpected(); |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 25 | #endif |
| 26 | |
| 27 | using terminate_handler = void (*)(); |
Nikolas Klauser | f1ea0b1 | 2023-06-14 17:17:50 | [diff] [blame] | 28 | _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT; |
| 29 | _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT; |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 30 | |
A. Jiang | 4ea2c73 | 2024-08-27 21:15:03 | [diff] [blame] | 31 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION) |
| 32 | _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 bool uncaught_exception() _NOEXCEPT; |
| 33 | #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_UNCAUGHT_EXCEPTION) |
philnik777 | ec350ad | 2023-11-01 22:56:43 | [diff] [blame] | 34 | _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT; |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 35 | |
Nikolas Klauser | f1ea0b1 | 2023-06-14 17:17:50 | [diff] [blame] | 36 | class _LIBCPP_EXPORTED_FROM_ABI exception_ptr; |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 37 | |
Nikolas Klauser | f1ea0b1 | 2023-06-14 17:17:50 | [diff] [blame] | 38 | _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT; |
Nikolas Klauser | 748023dc | 2024-09-11 06:59:46 | [diff] [blame] | 39 | [[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr); |
Nikolas Klauser | 4356228 | 2023-03-01 19:13:55 | [diff] [blame] | 40 | } // namespace std |
| 41 | |
| 42 | #endif // _LIBCPP___EXCEPTION_OPERATIONS_H |