Whole document tree
    

Whole document tree

eh_terminate.cc Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

eh_terminate.cc

Go to the documentation of this file.
00001 // -*- C++ -*- std::terminate, std::unexpected and friends.
00002 // Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 
00003 // Free Software Foundation
00004 //
00005 // This file is part of GNU CC.
00006 //
00007 // GNU CC is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2, or (at your option)
00010 // any later version.
00011 //
00012 // GNU CC is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with GNU CC; see the file COPYING.  If not, write to
00019 // the Free Software Foundation, 59 Temple Place - Suite 330,
00020 // Boston, MA 02111-1307, USA. 
00021 
00022 // As a special exception, you may use this file as part of a free software
00023 // library without restriction.  Specifically, if other files instantiate
00024 // templates or use macros or inline functions from this file, or you compile
00025 // this file and link it with other files to produce an executable, this
00026 // file does not by itself cause the resulting executable to be covered by
00027 // the GNU General Public License.  This exception does not however
00028 // invalidate any other reasons why the executable file might be covered by
00029 // the GNU General Public License.
00030 
00031 #include "typeinfo"
00032 #include "exception"
00033 #include <cstdlib>
00034 #include "unwind-cxx.h"
00035 #include "exception_defines.h"
00036 
00037 using namespace __cxxabiv1;
00038 
00039 /* The current installed user handlers.  */
00040 std::terminate_handler __cxxabiv1::__terminate_handler = std::abort;
00041 std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate;
00042 
00043 void
00044 __cxxabiv1::__terminate (std::terminate_handler handler)
00045 {
00046   try {
00047     handler ();
00048     std::abort ();
00049   } catch (...) {
00050     std::abort ();
00051   }
00052 }
00053 
00054 void
00055 std::terminate ()
00056 {
00057   __terminate (__terminate_handler);
00058 }
00059 
00060 void
00061 __cxxabiv1::__unexpected (std::unexpected_handler handler)
00062 {
00063   handler();
00064   std::terminate ();
00065 }
00066 
00067 void
00068 std::unexpected ()
00069 {
00070   __unexpected (__unexpected_handler);
00071 }
00072 
00073 std::terminate_handler
00074 std::set_terminate (std::terminate_handler func) throw()
00075 {
00076   std::terminate_handler old = __terminate_handler;
00077   __terminate_handler = func;
00078   return old;
00079 }
00080 
00081 std::unexpected_handler
00082 std::set_unexpected (std::unexpected_handler func) throw()
00083 {
00084   std::unexpected_handler old = __unexpected_handler;
00085   __unexpected_handler = func;
00086   return old;
00087 }

Generated on Mon Apr 8 03:11:24 2002 for libstdc++-v3 Source by doxygen1.2.15