| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
// Exception Handling support header (exception_ptr class) for -*- C++ -*- |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
// Copyright (C) 2008-2015 Free Software Foundation, Inc. |
|
4
|
|
|
|
|
|
|
// |
|
5
|
|
|
|
|
|
|
// This file is part of GCC. |
|
6
|
|
|
|
|
|
|
// |
|
7
|
|
|
|
|
|
|
// GCC is free software; you can redistribute it and/or modify |
|
8
|
|
|
|
|
|
|
// it under the terms of the GNU General Public License as published by |
|
9
|
|
|
|
|
|
|
// the Free Software Foundation; either version 3, or (at your option) |
|
10
|
|
|
|
|
|
|
// any later version. |
|
11
|
|
|
|
|
|
|
// |
|
12
|
|
|
|
|
|
|
// GCC is distributed in the hope that it will be useful, |
|
13
|
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
|
|
|
|
// GNU General Public License for more details. |
|
16
|
|
|
|
|
|
|
// |
|
17
|
|
|
|
|
|
|
// Under Section 7 of GPL version 3, you are granted additional |
|
18
|
|
|
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version |
|
19
|
|
|
|
|
|
|
// 3.1, as published by the Free Software Foundation. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and |
|
22
|
|
|
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program; |
|
23
|
|
|
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
|
24
|
|
|
|
|
|
|
// . |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
/** @file bits/exception_ptr.h |
|
27
|
|
|
|
|
|
|
* This is an internal header file, included by other library headers. |
|
28
|
|
|
|
|
|
|
* Do not attempt to use it directly. @headername{exception} |
|
29
|
|
|
|
|
|
|
*/ |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#ifndef _EXCEPTION_PTR_H |
|
32
|
|
|
|
|
|
|
#define _EXCEPTION_PTR_H |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#pragma GCC visibility push(default) |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#include |
|
37
|
|
|
|
|
|
|
#include |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#if ATOMIC_INT_LOCK_FREE < 2 |
|
40
|
|
|
|
|
|
|
# error This platform does not support exception propagation. |
|
41
|
|
|
|
|
|
|
#endif |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
extern "C++" { |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
namespace std |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
|
|
|
|
|
|
class type_info; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
/** |
|
50
|
|
|
|
|
|
|
* @addtogroup exceptions |
|
51
|
|
|
|
|
|
|
* @{ |
|
52
|
|
|
|
|
|
|
*/ |
|
53
|
|
|
|
|
|
|
namespace __exception_ptr |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
|
|
|
|
|
|
class exception_ptr; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
using __exception_ptr::exception_ptr; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
/** Obtain an exception_ptr to the currently handled exception. If there |
|
61
|
|
|
|
|
|
|
* is none, or the currently handled exception is foreign, return the null |
|
62
|
|
|
|
|
|
|
* value. |
|
63
|
|
|
|
|
|
|
*/ |
|
64
|
|
|
|
|
|
|
exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
/// Throw the object pointed to by the exception_ptr. |
|
67
|
|
|
|
|
|
|
void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
namespace __exception_ptr |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
|
|
|
|
|
|
/** |
|
72
|
|
|
|
|
|
|
* @brief An opaque pointer to an arbitrary exception. |
|
73
|
|
|
|
|
|
|
* @ingroup exceptions |
|
74
|
|
|
|
|
|
|
*/ |
|
75
|
|
|
|
|
|
|
class exception_ptr |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
|
|
|
|
|
|
void* _M_exception_object; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
void _M_addref() _GLIBCXX_USE_NOEXCEPT; |
|
82
|
|
|
|
|
|
|
void _M_release() _GLIBCXX_USE_NOEXCEPT; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__)); |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT; |
|
87
|
|
|
|
|
|
|
friend void std::rethrow_exception(exception_ptr); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
public: |
|
90
|
|
|
|
|
|
|
exception_ptr() _GLIBCXX_USE_NOEXCEPT; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#if __cplusplus >= 201103L |
|
95
|
0
|
|
|
|
|
|
exception_ptr(nullptr_t) noexcept |
|
96
|
0
|
|
|
|
|
|
: _M_exception_object(0) |
|
97
|
0
|
|
|
|
|
|
{ } |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
exception_ptr(exception_ptr&& __o) noexcept |
|
100
|
0
|
|
|
|
|
|
: _M_exception_object(__o._M_exception_object) |
|
101
|
0
|
|
|
|
|
|
{ __o._M_exception_object = 0; } |
|
102
|
|
|
|
|
|
|
#endif |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) |
|
105
|
|
|
|
|
|
|
typedef void (exception_ptr::*__safe_bool)(); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
// For construction from nullptr or 0. |
|
108
|
|
|
|
|
|
|
exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT; |
|
109
|
|
|
|
|
|
|
#endif |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
exception_ptr& |
|
112
|
|
|
|
|
|
|
operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#if __cplusplus >= 201103L |
|
115
|
|
|
|
|
|
|
exception_ptr& |
|
116
|
|
|
|
|
|
|
operator=(exception_ptr&& __o) noexcept |
|
117
|
|
|
|
|
|
|
{ |
|
118
|
|
|
|
|
|
|
exception_ptr(static_cast(__o)).swap(*this); |
|
119
|
|
|
|
|
|
|
return *this; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
#endif |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
~exception_ptr() _GLIBCXX_USE_NOEXCEPT; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
void |
|
126
|
|
|
|
|
|
|
swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
#ifdef _GLIBCXX_EH_PTR_COMPAT |
|
129
|
|
|
|
|
|
|
// Retained for compatibility with CXXABI_1.3. |
|
130
|
|
|
|
|
|
|
void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT |
|
131
|
|
|
|
|
|
|
__attribute__ ((__const__)); |
|
132
|
|
|
|
|
|
|
bool operator!() const _GLIBCXX_USE_NOEXCEPT |
|
133
|
|
|
|
|
|
|
__attribute__ ((__pure__)); |
|
134
|
|
|
|
|
|
|
operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT; |
|
135
|
|
|
|
|
|
|
#endif |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#if __cplusplus >= 201103L |
|
138
|
|
|
|
|
|
|
explicit operator bool() const |
|
139
|
|
|
|
|
|
|
{ return _M_exception_object; } |
|
140
|
|
|
|
|
|
|
#endif |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
friend bool |
|
143
|
|
|
|
|
|
|
operator==(const exception_ptr&, const exception_ptr&) |
|
144
|
|
|
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
const class std::type_info* |
|
147
|
|
|
|
|
|
|
__cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT |
|
148
|
|
|
|
|
|
|
__attribute__ ((__pure__)); |
|
149
|
|
|
|
|
|
|
}; |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
bool |
|
152
|
|
|
|
|
|
|
operator==(const exception_ptr&, const exception_ptr&) |
|
153
|
|
|
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
bool |
|
156
|
|
|
|
|
|
|
operator!=(const exception_ptr&, const exception_ptr&) |
|
157
|
|
|
|
|
|
|
_GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
inline void |
|
160
|
|
|
|
|
|
|
swap(exception_ptr& __lhs, exception_ptr& __rhs) |
|
161
|
|
|
|
|
|
|
{ __lhs.swap(__rhs); } |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
} // namespace __exception_ptr |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
/// Obtain an exception_ptr pointing to a copy of the supplied object. |
|
167
|
|
|
|
|
|
|
template |
|
168
|
|
|
|
|
|
|
exception_ptr |
|
169
|
|
|
|
|
|
|
make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT |
|
170
|
|
|
|
|
|
|
{ |
|
171
|
|
|
|
|
|
|
#if __cpp_exceptions |
|
172
|
|
|
|
|
|
|
try |
|
173
|
|
|
|
|
|
|
{ |
|
174
|
|
|
|
|
|
|
throw __ex; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
catch(...) |
|
177
|
|
|
|
|
|
|
{ |
|
178
|
|
|
|
|
|
|
return current_exception(); |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
#else |
|
181
|
|
|
|
|
|
|
return exception_ptr(); |
|
182
|
|
|
|
|
|
|
#endif |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
|
186
|
|
|
|
|
|
|
// 1130. copy_exception name misleading |
|
187
|
|
|
|
|
|
|
/// Obtain an exception_ptr pointing to a copy of the supplied object. |
|
188
|
|
|
|
|
|
|
/// This function is deprecated, use std::make_exception_ptr instead. |
|
189
|
|
|
|
|
|
|
template |
|
190
|
|
|
|
|
|
|
exception_ptr |
|
191
|
|
|
|
|
|
|
copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT _GLIBCXX_DEPRECATED; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
template |
|
194
|
|
|
|
|
|
|
exception_ptr |
|
195
|
|
|
|
|
|
|
copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT |
|
196
|
|
|
|
|
|
|
{ return std::make_exception_ptr<_Ex>(__ex); } |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
// @} group exceptions |
|
199
|
|
|
|
|
|
|
} // namespace std |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
} // extern "C++" |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
#pragma GCC visibility pop |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
#endif |