Howard Hinnant | e8fcf83 | 2011-12-07 21:16:40 +0000 | [diff] [blame] | 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 | |
Howard Hinnant | 0f80bb7 | 2012-03-19 16:20:34 +0000 | [diff] [blame] | 13 | #ifndef _CXA_HANDLERS_H |
| 14 | #define _CXA_HANDLERS_H |
| 15 | |
Saleem Abdulrasool | 46eb39a | 2016-09-23 21:36:24 +0000 | [diff] [blame] | 16 | #include <__cxxabi_config.h> |
| 17 | |
Howard Hinnant | e8fcf83 | 2011-12-07 21:16:40 +0000 | [diff] [blame] | 18 | #include <exception> |
| 19 | |
| 20 | namespace std |
| 21 | { |
| 22 | |
Shoaib Meenai | 54227ae | 2017-03-01 03:55:57 +0000 | [diff] [blame] | 23 | _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN |
Howard Hinnant | e8fcf83 | 2011-12-07 21:16:40 +0000 | [diff] [blame] | 24 | void |
| 25 | __unexpected(unexpected_handler func); |
| 26 | |
Shoaib Meenai | 54227ae | 2017-03-01 03:55:57 +0000 | [diff] [blame] | 27 | _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN |
Howard Hinnant | e8fcf83 | 2011-12-07 21:16:40 +0000 | [diff] [blame] | 28 | void |
| 29 | __terminate(terminate_handler func) _NOEXCEPT; |
| 30 | |
| 31 | } // std |
Howard Hinnant | 0f80bb7 | 2012-03-19 16:20:34 +0000 | [diff] [blame] | 32 | |
| 33 | extern "C" |
| 34 | { |
| 35 | |
Saleem Abdulrasool | 46eb39a | 2016-09-23 21:36:24 +0000 | [diff] [blame] | 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)(); |
Howard Hinnant | 0f80bb7 | 2012-03-19 16:20:34 +0000 | [diff] [blame] | 39 | |
Howard Hinnant | 4cfb63f | 2012-03-19 16:56:51 +0000 | [diff] [blame] | 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 |
Howard Hinnant | 6d00fef | 2013-02-15 15:48:49 +0000 | [diff] [blame] | 50 | portable performance optimization. |
Howard Hinnant | 4cfb63f | 2012-03-19 16:56:51 +0000 | [diff] [blame] | 51 | |
| 52 | */ |
| 53 | |
Howard Hinnant | 0f80bb7 | 2012-03-19 16:20:34 +0000 | [diff] [blame] | 54 | } // extern "C" |
| 55 | |
| 56 | #endif // _CXA_HANDLERS_H |