OSDN Git Service

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