xref: /aosp_15_r20/external/libcxxabi/src/cxa_handlers.hpp (revision c05d8e5dc3e10f6ce4317e8bc22cc4a25f55fa94)
1*c05d8e5dSAndroid Build Coastguard Worker //===------------------------- cxa_handlers.cpp ---------------------------===//
2*c05d8e5dSAndroid Build Coastguard Worker //
3*c05d8e5dSAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*c05d8e5dSAndroid Build Coastguard Worker //
5*c05d8e5dSAndroid Build Coastguard Worker // This file is dual licensed under the MIT and the University of Illinois Open
6*c05d8e5dSAndroid Build Coastguard Worker // Source Licenses. See LICENSE.TXT for details.
7*c05d8e5dSAndroid Build Coastguard Worker //
8*c05d8e5dSAndroid Build Coastguard Worker //
9*c05d8e5dSAndroid Build Coastguard Worker // This file implements the functionality associated with the terminate_handler,
10*c05d8e5dSAndroid Build Coastguard Worker //   unexpected_handler, and new_handler.
11*c05d8e5dSAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
12*c05d8e5dSAndroid Build Coastguard Worker 
13*c05d8e5dSAndroid Build Coastguard Worker #ifndef _CXA_HANDLERS_H
14*c05d8e5dSAndroid Build Coastguard Worker #define _CXA_HANDLERS_H
15*c05d8e5dSAndroid Build Coastguard Worker 
16*c05d8e5dSAndroid Build Coastguard Worker #include <__cxxabi_config.h>
17*c05d8e5dSAndroid Build Coastguard Worker 
18*c05d8e5dSAndroid Build Coastguard Worker #include <exception>
19*c05d8e5dSAndroid Build Coastguard Worker 
20*c05d8e5dSAndroid Build Coastguard Worker namespace std
21*c05d8e5dSAndroid Build Coastguard Worker {
22*c05d8e5dSAndroid Build Coastguard Worker 
23*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
24*c05d8e5dSAndroid Build Coastguard Worker void
25*c05d8e5dSAndroid Build Coastguard Worker __unexpected(unexpected_handler func);
26*c05d8e5dSAndroid Build Coastguard Worker 
27*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
28*c05d8e5dSAndroid Build Coastguard Worker void
29*c05d8e5dSAndroid Build Coastguard Worker __terminate(terminate_handler func) _NOEXCEPT;
30*c05d8e5dSAndroid Build Coastguard Worker 
31*c05d8e5dSAndroid Build Coastguard Worker }  // std
32*c05d8e5dSAndroid Build Coastguard Worker 
33*c05d8e5dSAndroid Build Coastguard Worker extern "C"
34*c05d8e5dSAndroid Build Coastguard Worker {
35*c05d8e5dSAndroid Build Coastguard Worker 
36*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_DATA_VIS extern void (*__cxa_terminate_handler)();
37*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_DATA_VIS extern void (*__cxa_unexpected_handler)();
38*c05d8e5dSAndroid Build Coastguard Worker _LIBCXXABI_DATA_VIS extern void (*__cxa_new_handler)();
39*c05d8e5dSAndroid Build Coastguard Worker 
40*c05d8e5dSAndroid Build Coastguard Worker /*
41*c05d8e5dSAndroid Build Coastguard Worker 
42*c05d8e5dSAndroid Build Coastguard Worker     At some point in the future these three symbols will become
43*c05d8e5dSAndroid Build Coastguard Worker     C++11 atomic variables:
44*c05d8e5dSAndroid Build Coastguard Worker 
45*c05d8e5dSAndroid Build Coastguard Worker     extern std::atomic<std::terminate_handler>  __cxa_terminate_handler;
46*c05d8e5dSAndroid Build Coastguard Worker     extern std::atomic<std::unexpected_handler> __cxa_unexpected_handler;
47*c05d8e5dSAndroid Build Coastguard Worker     extern std::atomic<std::new_handler>        __cxa_new_handler;
48*c05d8e5dSAndroid Build Coastguard Worker 
49*c05d8e5dSAndroid Build Coastguard Worker     This change will not impact their ABI.  But it will allow for a
50*c05d8e5dSAndroid Build Coastguard Worker     portable performance optimization.
51*c05d8e5dSAndroid Build Coastguard Worker 
52*c05d8e5dSAndroid Build Coastguard Worker */
53*c05d8e5dSAndroid Build Coastguard Worker 
54*c05d8e5dSAndroid Build Coastguard Worker } // extern "C"
55*c05d8e5dSAndroid Build Coastguard Worker 
56*c05d8e5dSAndroid Build Coastguard Worker #endif  // _CXA_HANDLERS_H
57