1 // Copyright (C) 2001, 2002 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.
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 // 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.
18 
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.
27 
28 #include <bits/functexcept.h>
29 #include <cstdlib>
30 #include <exception>
31 #include <stdexcept>
32 #include <new>
33 #include <typeinfo>
34 #include <ios>
35 
36 namespace std
37 {
38 #if __EXCEPTIONS
39   void
__throw_bad_exception(void)40   __throw_bad_exception(void)
41   { throw bad_exception(); }
42 
43   void
__throw_bad_alloc(void)44   __throw_bad_alloc(void)
45   { throw bad_alloc(); }
46 
47   void
__throw_bad_cast(void)48   __throw_bad_cast(void)
49   { throw bad_cast(); }
50 
51   void
__throw_bad_typeid(void)52   __throw_bad_typeid(void)
53   { throw bad_typeid(); }
54 
55   void
__throw_logic_error(const char * __s)56   __throw_logic_error(const char* __s)
57   { throw logic_error(__s); }
58 
59   void
__throw_domain_error(const char * __s)60   __throw_domain_error(const char* __s)
61   { throw domain_error(__s); }
62 
63   void
__throw_invalid_argument(const char * __s)64   __throw_invalid_argument(const char* __s)
65   { throw invalid_argument(__s); }
66 
67   void
__throw_length_error(const char * __s)68   __throw_length_error(const char* __s)
69   { throw length_error(__s); }
70 
71   void
__throw_out_of_range(const char * __s)72   __throw_out_of_range(const char* __s)
73   { throw out_of_range(__s); }
74 
75   void
__throw_runtime_error(const char * __s)76   __throw_runtime_error(const char* __s)
77   { throw runtime_error(__s); }
78 
79   void
__throw_range_error(const char * __s)80   __throw_range_error(const char* __s)
81   { throw range_error(__s); }
82 
83   void
__throw_overflow_error(const char * __s)84   __throw_overflow_error(const char* __s)
85   { throw overflow_error(__s); }
86 
87   void
__throw_underflow_error(const char * __s)88   __throw_underflow_error(const char* __s)
89   { throw underflow_error(__s); }
90 
91   void
__throw_ios_failure(const char * __s)92   __throw_ios_failure(const char* __s)
93   { throw ios_base::failure(__s); }
94 #else
95   void
96   __throw_bad_exception(void)
97   { abort(); }
98 
99   void
100   __throw_bad_alloc(void)
101   { abort(); }
102 
103   void
104   __throw_bad_cast(void)
105   { abort(); }
106 
107   void
108   __throw_bad_typeid(void)
109   { abort(); }
110 
111   void
112   __throw_logic_error(const char*)
113   { abort(); }
114 
115   void
116   __throw_domain_error(const char*)
117   { abort(); }
118 
119   void
120   __throw_invalid_argument(const char*)
121   { abort(); }
122 
123   void
124   __throw_length_error(const char*)
125   { abort(); }
126 
127   void
128   __throw_out_of_range(const char*)
129   { abort(); }
130 
131   void
132   __throw_runtime_error(const char*)
133   { abort(); }
134 
135   void
136   __throw_range_error(const char*)
137   { abort(); }
138 
139   void
140   __throw_overflow_error(const char*)
141   { abort(); }
142 
143   void
144   __throw_underflow_error(const char*)
145   { abort(); }
146 
147   void
148   __throw_ios_failure(const char*)
149   { abort(); }
150 #endif //__EXCEPTIONS
151 }
152