xref: /freebsd/contrib/llvm-project/libcxx/include/__exception/operations.h (revision 56b17de1e8360fe131d425de20b5e75ff3ea897c)
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 
12 #include <__config>
13 #include <cstddef>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #  pragma GCC system_header
17 #endif
18 
19 namespace std { // purposefully not using versioning namespace
20 #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) ||                             \
21     defined(_LIBCPP_BUILDING_LIBRARY)
22 using unexpected_handler = void (*)();
23 _LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
24 _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT;
25 _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected();
26 #endif
27 
28 using terminate_handler = void (*)();
29 _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
30 _LIBCPP_EXPORTED_FROM_ABI terminate_handler get_terminate() _NOEXCEPT;
31 
32 _LIBCPP_EXPORTED_FROM_ABI bool uncaught_exception() _NOEXCEPT;
33 _LIBCPP_EXPORTED_FROM_ABI int uncaught_exceptions() _NOEXCEPT;
34 
35 class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
36 
37 _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
38 _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
39 } // namespace std
40 
41 #endif // _LIBCPP___EXCEPTION_OPERATIONS_H
42