annotate libstdc++-v3/libsupc++/exception @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // Exception Handling support header for -*- C++ -*-
kono
parents:
diff changeset
2
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
3 // Copyright (C) 1995-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
4 //
kono
parents:
diff changeset
5 // This file is part of GCC.
kono
parents:
diff changeset
6 //
kono
parents:
diff changeset
7 // GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 // it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 // the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 // any later version.
kono
parents:
diff changeset
11 //
kono
parents:
diff changeset
12 // GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 // GNU General Public License for more details.
kono
parents:
diff changeset
16 //
kono
parents:
diff changeset
17 // Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
18 // permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
19 // 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 // You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
22 // a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
24 // <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /** @file exception
kono
parents:
diff changeset
27 * This is a Standard C++ Library header.
kono
parents:
diff changeset
28 */
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 #ifndef __EXCEPTION__
kono
parents:
diff changeset
31 #define __EXCEPTION__
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 #pragma GCC system_header
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 #pragma GCC visibility push(default)
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 #include <bits/c++config.h>
kono
parents:
diff changeset
38 #include <bits/exception.h>
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 extern "C++" {
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 namespace std
kono
parents:
diff changeset
43 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
44 /** @addtogroup exceptions
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
45 * @{
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
46 */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
47
111
kono
parents:
diff changeset
48 /** If an %exception is thrown which is not listed in a function's
kono
parents:
diff changeset
49 * %exception specification, one of these may be thrown. */
kono
parents:
diff changeset
50 class bad_exception : public exception
kono
parents:
diff changeset
51 {
kono
parents:
diff changeset
52 public:
kono
parents:
diff changeset
53 bad_exception() _GLIBCXX_USE_NOEXCEPT { }
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 // This declaration is not useless:
kono
parents:
diff changeset
56 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
kono
parents:
diff changeset
57 virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 // See comment in eh_exception.cc.
kono
parents:
diff changeset
60 virtual const char*
kono
parents:
diff changeset
61 what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT;
kono
parents:
diff changeset
62 };
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 /// If you write a replacement %terminate handler, it must be of this type.
kono
parents:
diff changeset
65 typedef void (*terminate_handler) ();
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 /// If you write a replacement %unexpected handler, it must be of this type.
kono
parents:
diff changeset
68 typedef void (*unexpected_handler) ();
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 /// Takes a new handler function as an argument, returns the old function.
kono
parents:
diff changeset
71 terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT;
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 #if __cplusplus >= 201103L
kono
parents:
diff changeset
74 /// Return the current terminate handler.
kono
parents:
diff changeset
75 terminate_handler get_terminate() noexcept;
kono
parents:
diff changeset
76 #endif
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 /** The runtime will call this function if %exception handling must be
kono
parents:
diff changeset
79 * abandoned for any reason. It can also be called by the user. */
kono
parents:
diff changeset
80 void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 /// Takes a new handler function as an argument, returns the old function.
kono
parents:
diff changeset
83 unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 #if __cplusplus >= 201103L
kono
parents:
diff changeset
86 /// Return the current unexpected handler.
kono
parents:
diff changeset
87 unexpected_handler get_unexpected() noexcept;
kono
parents:
diff changeset
88 #endif
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 /** The runtime will call this function if an %exception is thrown which
kono
parents:
diff changeset
91 * violates the function's %exception specification. */
kono
parents:
diff changeset
92 void unexpected() __attribute__ ((__noreturn__));
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 /** [18.6.4]/1: 'Returns true after completing evaluation of a
kono
parents:
diff changeset
95 * throw-expression until either completing initialization of the
kono
parents:
diff changeset
96 * exception-declaration in the matching handler or entering @c unexpected()
kono
parents:
diff changeset
97 * due to the throw; or after entering @c terminate() for any reason
kono
parents:
diff changeset
98 * other than an explicit call to @c terminate(). [Note: This includes
kono
parents:
diff changeset
99 * stack unwinding [15.2]. end note]'
kono
parents:
diff changeset
100 *
kono
parents:
diff changeset
101 * 2: 'When @c uncaught_exception() is true, throwing an
kono
parents:
diff changeset
102 * %exception can result in a call of @c terminate()
kono
parents:
diff changeset
103 * (15.5.1).'
kono
parents:
diff changeset
104 */
kono
parents:
diff changeset
105 _GLIBCXX17_DEPRECATED
kono
parents:
diff changeset
106 bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
kono
parents:
diff changeset
107
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
108 #if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++98
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
109 #define __cpp_lib_uncaught_exceptions 201411L
111
kono
parents:
diff changeset
110 /// The number of uncaught exceptions.
kono
parents:
diff changeset
111 int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
kono
parents:
diff changeset
112 #endif
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 // @} group exceptions
kono
parents:
diff changeset
115 } // namespace std
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 namespace __gnu_cxx
kono
parents:
diff changeset
118 {
kono
parents:
diff changeset
119 _GLIBCXX_BEGIN_NAMESPACE_VERSION
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 /**
kono
parents:
diff changeset
122 * @brief A replacement for the standard terminate_handler which
kono
parents:
diff changeset
123 * prints more information about the terminating exception (if any)
kono
parents:
diff changeset
124 * on stderr.
kono
parents:
diff changeset
125 *
kono
parents:
diff changeset
126 * @ingroup exceptions
kono
parents:
diff changeset
127 *
kono
parents:
diff changeset
128 * Call
kono
parents:
diff changeset
129 * @code
kono
parents:
diff changeset
130 * std::set_terminate(__gnu_cxx::__verbose_terminate_handler)
kono
parents:
diff changeset
131 * @endcode
kono
parents:
diff changeset
132 * to use. For more info, see
kono
parents:
diff changeset
133 * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html
kono
parents:
diff changeset
134 *
kono
parents:
diff changeset
135 * In 3.4 and later, this is on by default.
kono
parents:
diff changeset
136 */
kono
parents:
diff changeset
137 void __verbose_terminate_handler();
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 _GLIBCXX_END_NAMESPACE_VERSION
kono
parents:
diff changeset
140 } // namespace
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 } // extern "C++"
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 #pragma GCC visibility pop
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 #if (__cplusplus >= 201103L)
kono
parents:
diff changeset
147 #include <bits/exception_ptr.h>
kono
parents:
diff changeset
148 #include <bits/nested_exception.h>
kono
parents:
diff changeset
149 #endif
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 #endif