2 * Copyright (c) 1996,1997
3 * Silicon Graphics Computer Systems, Inc.
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
18 // The header <exception> contains low-level functions that interact
19 // with a compiler's exception-handling mechanism. It is assumed to
20 // be supplied with the compiler, rather than with the library, because
21 // it is inherently tied very closely to the compiler itself.
23 // On platforms where <exception> does not exist, this header defines
24 // an exception base class. This is *not* a substitute for everything
25 // in <exception>, but it suffices to support a bare minimum of STL
28 #ifndef _STLP_INTERNAL_EXCEPTION
29 #define _STLP_INTERNAL_EXCEPTION
31 #if !defined (_STLP_NO_EXCEPTION_HEADER)
33 # if defined ( _UNCAUGHT_EXCEPTION )
34 # undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
37 # if defined (_STLP_BROKEN_EXCEPTION_CLASS)
38 # define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
39 # define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
40 # if defined (_STLP_NO_NEW_NEW_HEADER)
41 # include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
43 # include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
48 # if defined (_STLP_NO_NEW_NEW_HEADER)
49 # if defined (_STLP_HAS_INCLUDE_NEXT)
50 # include_next <exception.h>
52 # include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
55 # if defined (_STLP_HAS_INCLUDE_NEXT)
56 # include_next <exception>
58 # include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
63 # if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1300)
65 // The header <yvals.h> which ships with vc6 and is included by its native <exception>
66 // actually turns on warnings, so we have to turn them back off.
67 # include <stl/config/_warnings_off.h>
70 # if defined (_STLP_USE_OWN_NAMESPACE)
73 # if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
74 # if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
75 using _STLP_VENDOR_EXCEPT_STD::exception
;
79 using _STLP_VENDOR_EXCEPT_STD::bad_exception
;
82 # if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
83 // fbp : many platforms present strange mix of
84 // those in various namespaces
85 # if !defined (_STLP_VENDOR_UNEXPECTED_STD)
86 # define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
88 /* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
89 * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
90 * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
92 # if !defined (_STLP_VENDOR_TERMINATE_STD)
93 # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
95 # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
96 # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
99 # if !defined (_STLP_VENDOR_TERMINATE_STD)
100 # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
102 # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
103 # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
105 # if !defined (_STLP_VENDOR_TERMINATE_STD)
106 # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
108 # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
109 # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
112 # if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
113 # if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
114 //See config/_intel.h for reason about this workaround
115 using std::unexpected
;
117 using _STLP_VENDOR_UNEXPECTED_STD::unexpected
;
119 using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler
;
120 using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected
;
122 using _STLP_VENDOR_TERMINATE_STD::terminate
;
123 using _STLP_VENDOR_TERMINATE_STD::terminate_handler
;
124 using _STLP_VENDOR_TERMINATE_STD::set_terminate
;
126 # if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
127 using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception
;
129 # endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
131 # endif /* _STLP_OWN_NAMESPACE */
132 #else /* _STLP_NO_EXCEPTION_HEADER */
134 /* fbp : absence of <exception> usually means that those
135 * functions are not going to be called by compiler.
136 * Still, define them for the user.
137 * dums: Policy modification, if the function do not behave like the Standard
138 * defined it we do not grant it in the STLport namespace. We will have
139 * compile time error rather than runtime error.
143 typedef void (*unexpected_handler)();
144 unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
147 typedef void (*terminate_handler)();
148 terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
151 bool uncaught_exception(); // not implemented under mpw as of Jan/1999
155 #endif /* _STLP_NO_EXCEPTION_HEADER */
157 #if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
158 _STLP_BEGIN_NAMESPACE
161 class _STLP_CLASS_DECLSPEC exception
{
163 # ifndef _STLP_USE_NO_IOSTREAMS
164 exception() _STLP_NOTHROW
;
165 virtual ~exception() _STLP_NOTHROW
;
166 virtual const char* what() const _STLP_NOTHROW
;
168 exception() _STLP_NOTHROW
{}
169 virtual ~exception() _STLP_NOTHROW
{}
170 virtual const char* what() const _STLP_NOTHROW
{return "class exception";}
175 class _STLP_CLASS_DECLSPEC bad_exception
: public exception
{
177 # ifndef _STLP_USE_NO_IOSTREAMS
178 bad_exception() _STLP_NOTHROW
;
179 ~bad_exception() _STLP_NOTHROW
;
180 const char* what() const _STLP_NOTHROW
;
182 bad_exception() _STLP_NOTHROW
{}
183 ~bad_exception() _STLP_NOTHROW
{}
184 const char* what() const _STLP_NOTHROW
{return "class bad_exception";}
188 // forward declaration
189 class __Named_exception
;
193 #endif /* _STLP_INTERNAL_EXCEPTION */