23
24
#ifndef _LIBCPPABI_VERSION
24
25
using namespace __cxxabiapple;
25
26
// On Darwin, there are two STL shared libraries and a lower level ABI
26
// shared libray. The globals holding the current terminate handler and
27
// shared library. The globals holding the current terminate handler and
27
28
// current unexpected handler are in the ABI library.
28
29
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
29
30
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
90
91
(*get_terminate())();
91
92
// handler should not return
92
93
printf("terminate_handler unexpectedly returned\n");
94
95
#ifndef _LIBCPP_NO_EXCEPTIONS
98
99
// handler should not throw exception
99
100
printf("terminate_handler unexpectedly threw an exception\n");
102
103
#endif // _LIBCPP_NO_EXCEPTIONS
111
112
// on Darwin, there is a helper function so __cxa_get_globals is private
112
113
return __cxa_uncaught_exception();
113
114
#else // __APPLE__
114
#warning uncaught_exception not yet implemented
115
# if defined(_MSC_VER) && ! defined(__clang__)
116
_LIBCPP_WARNING("uncaught_exception not yet implemented")
118
# warning uncaught_exception not yet implemented
115
120
printf("uncaught_exception not yet implemented\n");
117
122
#endif // __APPLE__
120
126
#ifndef _LIBCPPABI_VERSION
122
128
exception::~exception() _NOEXCEPT
152
#if defined(__GLIBCXX__)
154
// libsupc++ does not implement the dependent EH ABI and the functionality
155
// it uses to implement std::exception_ptr (which it declares as an alias of
156
// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
157
// we have little choice but to hijack std::__exception_ptr::exception_ptr's
158
// (which fortunately has the same layout as our std::exception_ptr) copy
159
// constructor, assignment operator and destructor (which are part of its
160
// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
163
namespace __exception_ptr
170
exception_ptr(const exception_ptr&) _NOEXCEPT;
171
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
172
~exception_ptr() _NOEXCEPT;
177
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
147
181
exception_ptr::~exception_ptr() _NOEXCEPT
149
183
#if HAVE_DEPENDENT_EH_ABI
150
184
__cxa_decrement_exception_refcount(__ptr_);
185
#elif defined(__GLIBCXX__)
186
reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
152
#warning exception_ptr not yet implemented
188
# if defined(_MSC_VER) && ! defined(__clang__)
189
_LIBCPP_WARNING("exception_ptr not yet implemented")
191
# warning exception_ptr not yet implemented
153
193
printf("exception_ptr not yet implemented\n");
158
198
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
161
201
#if HAVE_DEPENDENT_EH_ABI
162
202
__cxa_increment_exception_refcount(__ptr_);
203
#elif defined(__GLIBCXX__)
204
new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
205
reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
164
#warning exception_ptr not yet implemented
207
# if defined(_MSC_VER) && ! defined(__clang__)
208
_LIBCPP_WARNING("exception_ptr not yet implemented")
210
# warning exception_ptr not yet implemented
165
212
printf("exception_ptr not yet implemented\n");
170
217
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
177
224
__ptr_ = other.__ptr_;
181
#warning exception_ptr not yet implemented
227
#elif defined(__GLIBCXX__)
228
*reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
229
reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
232
# if defined(_MSC_VER) && ! defined(__clang__)
233
_LIBCPP_WARNING("exception_ptr not yet implemented")
235
# warning exception_ptr not yet implemented
182
237
printf("exception_ptr not yet implemented\n");
187
242
nested_exception::nested_exception() _NOEXCEPT
212
272
exception_ptr ptr;
213
273
ptr.__ptr_ = __cxa_current_primary_exception();
216
#warning exception_ptr not yet implemented
276
# if defined(_MSC_VER) && ! defined(__clang__)
277
_LIBCPP_WARNING( "exception_ptr not yet implemented" )
279
# warning exception_ptr not yet implemented
217
281
printf("exception_ptr not yet implemented\n");
286
#endif // !__GLIBCXX__
223
289
void rethrow_exception(exception_ptr p)
226
292
__cxa_rethrow_primary_exception(p.__ptr_);
227
293
// if p.__ptr_ is NULL, above returns so we terminate
230
#warning exception_ptr not yet implemented
295
#elif defined(__GLIBCXX__)
296
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
298
# if defined(_MSC_VER) && ! defined(__clang__)
299
_LIBCPP_WARNING("exception_ptr not yet implemented")
301
# warning exception_ptr not yet implemented
231
303
printf("exception_ptr not yet implemented\n");