1 //===------------------------- cxa_handlers.h -----------------------------===// 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 // This file implements the functionality associated with the terminate_handler, 9 // unexpected_handler, and new_handler. 10 //===----------------------------------------------------------------------===// 11 12 #ifndef _CXA_HANDLERS_H 13 #define _CXA_HANDLERS_H 14 15 #include "__cxxabi_config.h" 16 17 #include <exception> 18 19 namespace std 20 { 21 22 _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN 23 void 24 __unexpected(unexpected_handler func); 25 26 _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN 27 void 28 __terminate(terminate_handler func) _NOEXCEPT; 29 30 } // std 31 32 extern "C" 33 { 34 35 _LIBCXXABI_DATA_VIS extern void (*__cxa_terminate_handler)(); 36 _LIBCXXABI_DATA_VIS extern void (*__cxa_unexpected_handler)(); 37 _LIBCXXABI_DATA_VIS extern void (*__cxa_new_handler)(); 38 39 /* 40 41 At some point in the future these three symbols will become 42 C++11 atomic variables: 43 44 extern std::atomic<std::terminate_handler> __cxa_terminate_handler; 45 extern std::atomic<std::unexpected_handler> __cxa_unexpected_handler; 46 extern std::atomic<std::new_handler> __cxa_new_handler; 47 48 This change will not impact their ABI. But it will allow for a 49 portable performance optimization. 50 51 */ 52 53 } // extern "C" 54 55 #endif // _CXA_HANDLERS_H 56