PR 20085
[official-gcc.git] / libstdc++-v3 / src / functexcept.cc
blobfb158a61242bbf7a16fc1d281be309af39c6f534
1 // Copyright (C) 2001, 2002, 2003 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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 <new>
33 #include <typeinfo>
34 #include <ios>
35 #ifdef _GLIBCXX_USE_NLS
36 # include <libintl.h>
37 # define _(msgid) gettext (msgid)
38 #else
39 # define _(msgid) (msgid)
40 #endif
42 namespace std
44 #if __EXCEPTIONS
45 void
46 __throw_bad_exception(void)
47 { throw bad_exception(); }
49 void
50 __throw_bad_alloc(void)
51 { throw bad_alloc(); }
53 void
54 __throw_bad_cast(void)
55 { throw bad_cast(); }
57 void
58 __throw_bad_typeid(void)
59 { throw bad_typeid(); }
61 void
62 __throw_logic_error(const char* __s)
63 { throw logic_error(_(__s)); }
65 void
66 __throw_domain_error(const char* __s)
67 { throw domain_error(_(__s)); }
69 void
70 __throw_invalid_argument(const char* __s)
71 { throw invalid_argument(_(__s)); }
73 void
74 __throw_length_error(const char* __s)
75 { throw length_error(_(__s)); }
77 void
78 __throw_out_of_range(const char* __s)
79 { throw out_of_range(_(__s)); }
81 void
82 __throw_runtime_error(const char* __s)
83 { throw runtime_error(_(__s)); }
85 void
86 __throw_range_error(const char* __s)
87 { throw range_error(_(__s)); }
89 void
90 __throw_overflow_error(const char* __s)
91 { throw overflow_error(_(__s)); }
93 void
94 __throw_underflow_error(const char* __s)
95 { throw underflow_error(_(__s)); }
97 void
98 __throw_ios_failure(const char* __s)
99 { throw ios_base::failure(_(__s)); }
100 #else
101 void
102 __throw_bad_exception(void)
103 { abort(); }
105 void
106 __throw_bad_alloc(void)
107 { abort(); }
109 void
110 __throw_bad_cast(void)
111 { abort(); }
113 void
114 __throw_bad_typeid(void)
115 { abort(); }
117 void
118 __throw_logic_error(const char*)
119 { abort(); }
121 void
122 __throw_domain_error(const char*)
123 { abort(); }
125 void
126 __throw_invalid_argument(const char*)
127 { abort(); }
129 void
130 __throw_length_error(const char*)
131 { abort(); }
133 void
134 __throw_out_of_range(const char*)
135 { abort(); }
137 void
138 __throw_runtime_error(const char*)
139 { abort(); }
141 void
142 __throw_range_error(const char*)
143 { abort(); }
145 void
146 __throw_overflow_error(const char*)
147 { abort(); }
149 void
150 __throw_underflow_error(const char*)
151 { abort(); }
153 void
154 __throw_ios_failure(const char*)
155 { abort(); }
156 #endif //__EXCEPTIONS