This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] -fno-exceptions cleanup
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 22 Mar 2002 12:07:34 -0800
- Subject: [v3] -fno-exceptions cleanup
Not so hard.
tested with make CXXFLAGS='-fno-exceptions' all
gcc-3_1-branch
gcc
2002-03-22 Benjamin Kosnik <bkoz@redhat.com>
* src/vterminate.cc: Format, -fno-exceptions cleanup.
Index: src/vterminate.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/vterminate.cc,v
retrieving revision 1.3
diff -c -p -r1.3 vterminate.cc
*** vterminate.cc 2001/11/23 17:36:43 1.3
--- vterminate.cc 2002/03/22 20:04:05
***************
*** 1,6 ****
// Verbose terminate_handler -*- C++ -*-
! // Copyright (C) 2001 Free Software Foundation
//
// This file is part of GNU CC.
//
--- 1,6 ----
// Verbose terminate_handler -*- C++ -*-
! // Copyright (C) 2001, 2002 Free Software Foundation
//
// This file is part of GNU CC.
//
***************
*** 28,36 ****
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
- #include <exception>
#include <cstdlib>
#include <cstdio>
#include <cxxabi.h>
using namespace std;
--- 28,37 ----
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <cstdlib>
#include <cstdio>
+ #include <exception>
+ #include <exception_defines.h>
#include <cxxabi.h>
using namespace std;
*************** using namespace abi;
*** 38,83 ****
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.
!
{
! int status = -1;
! char *dem = 0;
!
#if 0
! // 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);
! 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 ();
! }
!
} // namespace __gnu_cxx
--- 39,85 ----
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.
!
! {
! int status = -1;
! char *dem = 0;
!
#if 0
! // 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);
! 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