2008-12-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git] / libstdc++-v3 / src / functexcept.cc
blob266e035662a7e20fed56a6f83d3332f933eecd84
1 // Copyright (C) 2001, 2002, 2003, 2005 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 2, or (at your option)
7 // any later version.
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.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 // USA.
19 // As a special exception, you may use this file as part of a free software
20 // library without restriction. Specifically, if other files instantiate
21 // templates or use macros or inline functions from this file, or you compile
22 // this file and link it with other files to produce an executable, this
23 // file does not by itself cause the resulting executable to be covered by
24 // the GNU General Public License. This exception does not however
25 // invalidate any other reasons why the executable file might be covered by
26 // the GNU General Public License.
28 #include <bits/functexcept.h>
29 #include <cstdlib>
30 #include <exception>
31 #include <stdexcept>
32 #include <system_error>
33 #include <new>
34 #include <typeinfo>
35 #include <ios>
37 #ifdef _GLIBCXX_USE_NLS
38 # include <libintl.h>
39 # define _(msgid) gettext (msgid)
40 #else
41 # define _(msgid) (msgid)
42 #endif
44 _GLIBCXX_BEGIN_NAMESPACE(std)
46 #if __EXCEPTIONS
47 void
48 __throw_bad_exception(void)
49 { throw bad_exception(); }
51 void
52 __throw_bad_alloc(void)
53 { throw bad_alloc(); }
55 void
56 __throw_bad_cast(void)
57 { throw bad_cast(); }
59 void
60 __throw_bad_typeid(void)
61 { throw bad_typeid(); }
63 void
64 __throw_logic_error(const char* __s)
65 { throw logic_error(_(__s)); }
67 void
68 __throw_domain_error(const char* __s)
69 { throw domain_error(_(__s)); }
71 void
72 __throw_invalid_argument(const char* __s)
73 { throw invalid_argument(_(__s)); }
75 void
76 __throw_length_error(const char* __s)
77 { throw length_error(_(__s)); }
79 void
80 __throw_out_of_range(const char* __s)
81 { throw out_of_range(_(__s)); }
83 void
84 __throw_runtime_error(const char* __s)
85 { throw runtime_error(_(__s)); }
87 void
88 __throw_range_error(const char* __s)
89 { throw range_error(_(__s)); }
91 void
92 __throw_overflow_error(const char* __s)
93 { throw overflow_error(_(__s)); }
95 void
96 __throw_underflow_error(const char* __s)
97 { throw underflow_error(_(__s)); }
99 void
100 __throw_system_error(const char* __s)
101 { throw system_error(error_code(), _(__s)); }
103 void
104 __throw_system_error(int __i)
105 { throw system_error(error_code(__i, generic_category)); }
107 void
108 __throw_ios_failure(const char* __s)
109 { throw ios_base::failure(_(__s)); }
110 #else
111 void
112 __throw_bad_exception(void)
113 { std::abort(); }
115 void
116 __throw_bad_alloc(void)
117 { std::abort(); }
119 void
120 __throw_bad_cast(void)
121 { std::abort(); }
123 void
124 __throw_bad_typeid(void)
125 { std::abort(); }
127 void
128 __throw_logic_error(const char*)
129 { std::abort(); }
131 void
132 __throw_domain_error(const char*)
133 { std::abort(); }
135 void
136 __throw_invalid_argument(const char*)
137 { std::abort(); }
139 void
140 __throw_length_error(const char*)
141 { std::abort(); }
143 void
144 __throw_out_of_range(const char*)
145 { std::abort(); }
147 void
148 __throw_runtime_error(const char*)
149 { std::abort(); }
151 void
152 __throw_range_error(const char*)
153 { std::abort(); }
155 void
156 __throw_overflow_error(const char*)
157 { std::abort(); }
159 void
160 __throw_underflow_error(const char*)
161 { std::abort(); }
163 void
164 __throw_system_error(const char* __s)
165 { std::abort(); }
167 void
168 __throw_system_error(int __i)
169 { std::abort(); }
171 void
172 __throw_ios_failure(const char*)
173 { std::abort(); }
174 #endif //__EXCEPTIONS
176 _GLIBCXX_END_NAMESPACE