# functexcept.cc

    00001 // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    00002 //
    00003 // This file is part of the GNU ISO C++ Library.  This library is free
    00004 // software; you can redistribute it and/or modify it under the
    00005 // terms of the GNU General Public License as published by the
    00006 // Free Software Foundation; either version 2, or (at your option)
    00007 // any later version.
    00008
    00009 // This library is distributed in the hope that it will be useful,
    00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012 // GNU General Public License for more details.
    00013
    00014 // You should have received a copy of the GNU General Public License along
    00015 // with this library; see the file COPYING.  If not, write to the Free
    00016 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    00017 // USA.
    00018
    00019 // As a special exception, you may use this file as part of a free software
    00020 // library without restriction.  Specifically, if other files instantiate
    00021 // templates or use macros or inline functions from this file, or you compile
    00022 // this file and link it with other files to produce an executable, this
    00023 // file does not by itself cause the resulting executable to be covered by
    00024 // the GNU General Public License.  This exception does not however
    00025 // invalidate any other reasons why the executable file might be covered by
    00026 // the GNU General Public License.
    00027
    00028 #include <bits/functexcept.h>
    00029 #include <cstdlib>
    00030 #include <exception>
    00031 #include <stdexcept>
    00032 #include <new>
    00033 #include <typeinfo>
    00034 #include <ios>
    00035 #ifdef _GLIBCXX_USE_NLS
    00036 # include <libintl.h>
    00037 # define _(msgid)   gettext (msgid)
    00038 #else
    00039 # define _(msgid)   (msgid)
    00040 #endif
    00041
    00042 namespace std
    00043 {
    00044 #if __EXCEPTIONS
    00045   void
    00046   __throw_bad_exception(void)
    00047   { throw bad_exception(); }
    00048
    00049   void
    00050   __throw_bad_alloc(void)
    00051   { throw bad_alloc(); }
    00052
    00053   void
    00054   __throw_bad_cast(void)
    00055   { throw bad_cast(); }
    00056
    00057   void
    00058   __throw_bad_typeid(void)
    00059   { throw bad_typeid(); }
    00060
    00061   void
    00062   __throw_logic_error(const char* __s)
    00063   { throw logic_error(_(__s)); }
    00064
    00065   void
    00066   __throw_domain_error(const char* __s)
    00067   { throw domain_error(_(__s)); }
    00068
    00069   void
    00070   __throw_invalid_argument(const char* __s)
    00071   { throw invalid_argument(_(__s)); }
    00072
    00073   void
    00074   __throw_length_error(const char* __s)
    00075   { throw length_error(_(__s)); }
    00076
    00077   void
    00078   __throw_out_of_range(const char* __s)
    00079   { throw out_of_range(_(__s)); }
    00080
    00081   void
    00082   __throw_runtime_error(const char* __s)
    00083   { throw runtime_error(_(__s)); }
    00084
    00085   void
    00086   __throw_range_error(const char* __s)
    00087   { throw range_error(_(__s)); }
    00088
    00089   void
    00090   __throw_overflow_error(const char* __s)
    00091   { throw overflow_error(_(__s)); }
    00092
    00093   void
    00094   __throw_underflow_error(const char* __s)
    00095   { throw underflow_error(_(__s)); }
    00096
    00097   void
    00098   __throw_ios_failure(const char* __s)
    00099   { throw ios_base::failure(_(__s)); }
    00100 #else
    00101   void
    00102   __throw_bad_exception(void)
    00103   { abort(); }
    00104
    00105   void
    00106   __throw_bad_alloc(void)
    00107   { abort(); }
    00108
    00109   void
    00110   __throw_bad_cast(void)
    00111   { abort(); }
    00112
    00113   void
    00114   __throw_bad_typeid(void)
    00115   { abort(); }
    00116
    00117   void
    00118   __throw_logic_error(const char*)
    00119   { abort(); }
    00120
    00121   void
    00122   __throw_domain_error(const char*)
    00123   { abort(); }
    00124
    00125   void
    00126   __throw_invalid_argument(const char*)
    00127   { abort(); }
    00128
    00129   void
    00130   __throw_length_error(const char*)
    00131   { abort(); }
    00132
    00133   void
    00134   __throw_out_of_range(const char*)
    00135   { abort(); }
    00136
    00137   void
    00138   __throw_runtime_error(const char*)
    00139   { abort(); }
    00140
    00141   void
    00142   __throw_range_error(const char*)
    00143   { abort(); }
    00144
    00145   void
    00146   __throw_overflow_error(const char*)
    00147   { abort(); }
    00148
    00149   void
    00150   __throw_underflow_error(const char*)
    00151   { abort(); }
    00152
    00153   void
    00154   __throw_ios_failure(const char*)
    00155   { abort(); }
    00156 #endif //__EXCEPTIONS
    00157 }