diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-22 20:13:43 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-22 20:13:43 +0000 |
commit | ec068f11fb9fee50619a4b65f8cb72e659df2809 (patch) | |
tree | ea75ac04b13e5bfff77b8de260446036d96605e6 /libstdc++-v3 | |
parent | 1707315d0ed21a3152bddf4d65fa3c45f4282991 (diff) | |
download | gcc-ec068f11fb9fee50619a4b65f8cb72e659df2809.tar.gz |
2002-03-22 Benjamin Kosnik <bkoz@redhat.com>
* src/vterminate.cc: Format, -fno-exceptions cleanup.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51185 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 4 | ||||
-rw-r--r-- | libstdc++-v3/src/vterminate.cc | 78 |
2 files changed, 44 insertions, 38 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f797b89083d..b910f5bb2e6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2002-03-22 Benjamin Kosnik <bkoz@redhat.com> + + * src/vterminate.cc: Format, -fno-exceptions cleanup. + 2002-03-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * acinclude.m4 (GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3): New. diff --git a/libstdc++-v3/src/vterminate.cc b/libstdc++-v3/src/vterminate.cc index 942d6b55eab..9475d1ad6fd 100644 --- a/libstdc++-v3/src/vterminate.cc +++ b/libstdc++-v3/src/vterminate.cc @@ -1,6 +1,6 @@ // Verbose terminate_handler -*- C++ -*- -// Copyright (C) 2001 Free Software Foundation +// Copyright (C) 2001, 2002 Free Software Foundation // // This file is part of GNU CC. // @@ -28,9 +28,10 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <exception> #include <cstdlib> #include <cstdio> +#include <exception> +#include <exception_defines.h> #include <cxxabi.h> using namespace std; @@ -38,46 +39,47 @@ using namespace abi; namespace __gnu_cxx { - -/* A replacement for the standard terminate_handler which prints - more information about the terminating exception (if any) on stderr. */ -void __verbose_terminate_handler () -{ - // Make sure there was an exception; terminate is also called for an - // attempt to rethrow when there is no suitable exception. - type_info *t = __cxa_current_exception_type (); - if (t) - { - char const *name = t->name (); - // Note that "name" is the mangled name. - + /* A replacement for the standard terminate_handler which prints + more information about the terminating exception (if any) on + stderr. */ + void __verbose_terminate_handler() + { + // Make sure there was an exception; terminate is also called for an + // attempt to rethrow when there is no suitable exception. + type_info *t = __cxa_current_exception_type(); + if (t) { - int status = -1; - char *dem = 0; - + char const *name = t->name(); + // Note that "name" is the mangled name. + + { + int status = -1; + char *dem = 0; + #if 0 - // Disabled until __cxa_demangle gets the runtime GPL exception. - dem = __cxa_demangle (name, 0, 0, &status); + // Disabled until __cxa_demangle gets the runtime GPL exception. + dem = __cxa_demangle(name, 0, 0, &status); #endif - printf ("terminate called after throwing a `%s'\n", - status == 0 ? dem : name); + printf("terminate called after throwing a `%s'\n", + status == 0 ? dem : name); - if (status == 0) - free (dem); - } - - // If the exception is derived from std::exception, we can give more - // information. - try { throw; } - catch (exception &exc) - { fprintf (stderr, " what(): %s\n", exc.what()); } - catch (...) { } - } - else - fprintf (stderr, "terminate called without an active exception\n"); - - abort (); -} + if (status == 0) + free(dem); + } + // If the exception is derived from std::exception, we can give more + // information. + try { __throw_exception_again; } +#ifdef __EXCEPTIONS + catch (exception &exc) + { fprintf(stderr, " what(): %s\n", exc.what()); } +#endif + catch (...) { } + } + else + fprintf(stderr, "terminate called without an active exception\n"); + + abort(); + } } // namespace __gnu_cxx |