31 #ifndef _EXCEPTION_PTR_H
32 #define _EXCEPTION_PTR_H
34 #pragma GCC visibility push(default)
53 namespace __exception_ptr
58 using __exception_ptr::exception_ptr;
66 template<typename _Ex>
72 namespace __exception_ptr
82 void* _M_exception_object;
86 void _M_addref() _GLIBCXX_USE_NOEXCEPT;
87 void _M_release() _GLIBCXX_USE_NOEXCEPT;
89 void *_M_get()
const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
93 template<
typename _Ex>
101 #if __cplusplus >= 201103L
103 : _M_exception_object(0)
107 : _M_exception_object(__o._M_exception_object)
108 { __o._M_exception_object = 0; }
111 #if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT)
121 #if __cplusplus >= 201103L
135 #ifdef _GLIBCXX_EH_PTR_COMPAT
137 void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
138 __attribute__ ((__const__));
139 bool operator!()
const _GLIBCXX_USE_NOEXCEPT
140 __attribute__ ((__pure__));
141 operator __safe_bool()
const _GLIBCXX_USE_NOEXCEPT;
144 #if __cplusplus >= 201103L
145 explicit operator bool()
const
146 {
return _M_exception_object; }
151 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
154 __cxa_exception_type()
const _GLIBCXX_USE_NOEXCEPT
155 __attribute__ ((__pure__));
162 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
166 _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
170 { __lhs.swap(__rhs); }
175 template<
typename _Ex>
177 __dest_thunk(
void* __x)
178 {
static_cast<_Ex*
>(__x)->~_Ex(); }
184 template<
typename _Ex>
188 #if __cpp_exceptions && __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI
189 void* __e = __cxxabiv1::__cxa_allocate_exception(
sizeof(_Ex));
190 (void) __cxxabiv1::__cxa_init_primary_exception(
192 __exception_ptr::__dest_thunk<_Ex>);
195 ::new (__e) _Ex(__ex);
200 __cxxabiv1::__cxa_free_exception(__e);
203 #elif __cpp_exceptions
212 #else // no RTTI and no exceptions
222 #pragma GCC visibility pop