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