OSDN Git Service

2009-12-15 Jonathan Wakely <jwakely.gcc@gmail.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / functexcept.cc
1 // Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library.  This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13
14 // Under Section 7 of GPL version 3, you are granted additional
15 // permissions described in the GCC Runtime Library Exception, version
16 // 3.1, as published by the Free Software Foundation.
17
18 // You should have received a copy of the GNU General Public License and
19 // a copy of the GCC Runtime Library Exception along with this program;
20 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
21 // <http://www.gnu.org/licenses/>.
22
23 #include <bits/functexcept.h>
24 #include <cstdlib>
25 #include <exception>
26 #include <stdexcept>
27 #include <new>
28 #include <typeinfo>
29 #include <ios>
30 #include <system_error>
31 #include <future>
32 #include <functional>
33
34 #ifdef _GLIBCXX_USE_NLS
35 # include <libintl.h>
36 # define _(msgid)   gettext (msgid)
37 #else
38 # define _(msgid)   (msgid)
39 #endif
40
41 _GLIBCXX_BEGIN_NAMESPACE(std)
42
43 #if __EXCEPTIONS
44   void
45   __throw_bad_exception(void)
46   { throw bad_exception(); }
47
48   void
49   __throw_bad_alloc(void)
50   { throw bad_alloc(); }
51
52   void
53   __throw_bad_cast(void)
54   { throw bad_cast(); }
55
56   void
57   __throw_bad_typeid(void)
58   { throw bad_typeid(); }
59
60   void
61   __throw_logic_error(const char* __s)
62   { throw logic_error(_(__s)); }
63
64   void
65   __throw_domain_error(const char* __s)
66   { throw domain_error(_(__s)); }
67
68   void
69   __throw_invalid_argument(const char* __s)
70   { throw invalid_argument(_(__s)); }
71
72   void
73   __throw_length_error(const char* __s)
74   { throw length_error(_(__s)); }
75
76   void
77   __throw_out_of_range(const char* __s)
78   { throw out_of_range(_(__s)); }
79
80   void
81   __throw_runtime_error(const char* __s)
82   { throw runtime_error(_(__s)); }
83
84   void
85   __throw_range_error(const char* __s)
86   { throw range_error(_(__s)); }
87
88   void
89   __throw_overflow_error(const char* __s)
90   { throw overflow_error(_(__s)); }
91
92   void
93   __throw_underflow_error(const char* __s)
94   { throw underflow_error(_(__s)); }
95
96   void
97   __throw_ios_failure(const char* __s)
98   { throw ios_base::failure(_(__s)); }
99
100   void
101   __throw_system_error(int __i)
102   { throw system_error(error_code(__i, generic_category())); }
103
104   void
105   __throw_future_error(int __i)
106   { throw future_error(future_errc(__i)); }
107
108   void
109   __throw_bad_function_call()
110   { throw bad_function_call(); }
111 #else
112   void
113   __throw_bad_exception(void)
114   { std::abort(); }
115
116   void
117   __throw_bad_alloc(void)
118   { std::abort(); }
119
120   void
121   __throw_bad_cast(void)
122   { std::abort(); }
123
124   void
125   __throw_bad_typeid(void)
126   { std::abort(); }
127
128   void
129   __throw_logic_error(const char*)
130   { std::abort(); }
131
132   void
133   __throw_domain_error(const char*)
134   { std::abort(); }
135
136   void
137   __throw_invalid_argument(const char*)
138   { std::abort(); }
139
140   void
141   __throw_length_error(const char*)
142   { std::abort(); }
143
144   void
145   __throw_out_of_range(const char*)
146   { std::abort(); }
147
148   void
149   __throw_runtime_error(const char*)
150   { std::abort(); }
151
152   void
153   __throw_range_error(const char*)
154   { std::abort(); }
155
156   void
157   __throw_overflow_error(const char*)
158   { std::abort(); }
159
160   void
161   __throw_underflow_error(const char*)
162   { std::abort(); }
163
164   void
165   __throw_ios_failure(const char*)
166   { std::abort(); }
167
168   void
169   __throw_system_error(int)
170   { std::abort(); }
171
172   void
173   __throw_future_error(int)
174   { std::abort(); }
175
176   void
177   __throw_bad_function_call()
178   { std::abort(); }
179
180 #endif //__EXCEPTIONS
181
182 _GLIBCXX_END_NAMESPACE