summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-18 02:09:23 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-18 02:09:23 +0000
commit3c70bc92294a35a51e695094ae6e26c3cb1adf03 (patch)
tree6a65bccb2be735bc17b004a6ee62e5a043ceaea3 /libstdc++-v3
parent1ccaa52c8bc92bb633d772f32510380838c0d347 (diff)
downloadgcc-3c70bc92294a35a51e695094ae6e26c3cb1adf03.tar.gz
* libsupc++/eh_personality.cc (__cxa_call_unexpected): Take void*.
* libsupc++/eh_catch.cc (__cxa_begin_catch): Likewise. * libsupc++/unwind-cxx.h: Adjust. * src/Makefile.am (strstream.o): Pass -Wno-deprecated. * libsupc++/eh_type.cc (__cxa_current_exception_type): New file. * libsupc++/cxxabi.h: Declare it. * libsupc++/Makefile.am (sources): Add it. * src/vterminate.cc (verbose_terminate_handler): New file. * libsupc++/exception: Declare it. * src/Makefile.am (sources): Add it. * src/Makefile.am (VPATH): Check the src directory before the top one. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47132 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog16
-rw-r--r--libstdc++-v3/libsupc++/Makefile.am1
-rw-r--r--libstdc++-v3/libsupc++/Makefile.in8
-rw-r--r--libstdc++-v3/libsupc++/cxxabi.h5
-rw-r--r--libstdc++-v3/libsupc++/eh_catch.cc5
-rw-r--r--libstdc++-v3/libsupc++/eh_personality.cc5
-rw-r--r--libstdc++-v3/libsupc++/eh_type.cc49
-rw-r--r--libstdc++-v3/libsupc++/exception6
-rw-r--r--libstdc++-v3/libsupc++/unwind-cxx.h5
-rw-r--r--libstdc++-v3/src/Makefile.am8
-rw-r--r--libstdc++-v3/src/Makefile.in14
-rw-r--r--libstdc++-v3/src/vterminate.cc82
12 files changed, 185 insertions, 19 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2f518506198..8ddd1af5500 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2001-11-18 Jason Merrill <jason@redhat.com>
+
+ * libsupc++/eh_personality.cc (__cxa_call_unexpected): Take void*.
+ * libsupc++/eh_catch.cc (__cxa_begin_catch): Likewise.
+ * libsupc++/unwind-cxx.h: Adjust.
+ * src/Makefile.am (strstream.o): Pass -Wno-deprecated.
+
+ * libsupc++/eh_type.cc (__cxa_current_exception_type): New file.
+ * libsupc++/cxxabi.h: Declare it.
+ * libsupc++/Makefile.am (sources): Add it.
+ * src/vterminate.cc (verbose_terminate_handler): New file.
+ * libsupc++/exception: Declare it.
+ * src/Makefile.am (sources): Add it.
+
+ * src/Makefile.am (VPATH): Check the src directory before the top one.
+
2001-11-16 Paolo Carlini <pcarlini@unitus.it>
* include/bits/stl_deque.h (deque::erase()): Fix memory leak.
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am
index c6981a05b29..bdde27b17f3 100644
--- a/libstdc++-v3/libsupc++/Makefile.am
+++ b/libstdc++-v3/libsupc++/Makefile.am
@@ -78,6 +78,7 @@ sources = \
eh_personality.cc \
eh_terminate.cc \
eh_throw.cc \
+ eh_type.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 5d5fe78c4a1..fbf3f139eb1 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -206,6 +206,7 @@ sources = \
eh_personality.cc \
eh_terminate.cc \
eh_throw.cc \
+ eh_type.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
@@ -287,15 +288,16 @@ libsupc__convenience_la_LDFLAGS =
libsupc__convenience_la_LIBADD =
libsupc__convenience_la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo \
del_opvnt.lo eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo \
-eh_globals.lo eh_personality.lo eh_terminate.lo eh_throw.lo \
+eh_globals.lo eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo \
new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo \
tinfo.lo tinfo2.lo vec.lo
libsupc___la_LDFLAGS =
libsupc___la_LIBADD =
libsupc___la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \
eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo eh_globals.lo \
-eh_personality.lo eh_terminate.lo eh_throw.lo new_handler.lo new_op.lo \
-new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo tinfo2.lo vec.lo
+eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo new_handler.lo \
+new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo \
+tinfo2.lo vec.lo
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h
index 1d4464a274e..e695ce5a223 100644
--- a/libstdc++-v3/libsupc++/cxxabi.h
+++ b/libstdc++-v3/libsupc++/cxxabi.h
@@ -509,6 +509,11 @@ char *__cxa_demangle (const char *__mangled_name,
__SIZE_TYPE__ *__length,
int *__status);
+// Returns the type_info for the currently handled exception [15.3/8], or
+// null if there is none.
+extern "C"
+std::type_info *__cxa_current_exception_type ();
+
} /* namespace __cxxabiv1 */
/* User programs should use the alias `abi'. */
diff --git a/libstdc++-v3/libsupc++/eh_catch.cc b/libstdc++-v3/libsupc++/eh_catch.cc
index f6879075602..ba49dfe7e44 100644
--- a/libstdc++-v3/libsupc++/eh_catch.cc
+++ b/libstdc++-v3/libsupc++/eh_catch.cc
@@ -35,8 +35,11 @@ using namespace __cxxabiv1;
extern "C" void *
-__cxa_begin_catch (_Unwind_Exception *exceptionObject)
+__cxa_begin_catch (void *exc_obj_in)
{
+ _Unwind_Exception *exceptionObject
+ = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
+
// ??? Foreign exceptions can't be stacked here, and there doesn't
// appear to be any place to store for __cxa_end_catch to destroy.
diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc
index 5c0ec500632..9b235a0e55f 100644
--- a/libstdc++-v3/libsupc++/eh_personality.cc
+++ b/libstdc++-v3/libsupc++/eh_personality.cc
@@ -399,8 +399,11 @@ PERSONALITY_FUNCTION (int version,
}
extern "C" void
-__cxa_call_unexpected (_Unwind_Exception *exc_obj)
+__cxa_call_unexpected (void *exc_obj_in)
{
+ _Unwind_Exception *exc_obj
+ = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
+
__cxa_begin_catch (exc_obj);
// This function is a handler for our exception argument. If we exit
diff --git a/libstdc++-v3/libsupc++/eh_type.cc b/libstdc++-v3/libsupc++/eh_type.cc
new file mode 100644
index 00000000000..ef9da9c3ac4
--- /dev/null
+++ b/libstdc++-v3/libsupc++/eh_type.cc
@@ -0,0 +1,49 @@
+// -*- C++ -*- Exception handling routines for catching.
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of GNU CC.
+//
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#include <typeinfo>
+#include "unwind-cxx.h"
+
+namespace __cxxabiv1 {
+
+// Returns the type_info for the currently handled exception [15.3/8], or
+// null if there is none.
+extern "C"
+std::type_info *__cxa_current_exception_type ()
+{
+ __cxa_eh_globals *globals = __cxa_get_globals ();
+ __cxa_exception *header = globals->caughtExceptions;
+ if (header)
+ return header->exceptionType;
+ else
+ return 0;
+}
+
+} // namespace __cxxabiv1
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index a1daf8811cc..3463f3d34b4 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -95,6 +95,12 @@ namespace std
bool uncaught_exception() throw();
} // namespace std
+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 ();
+} // namespace __gnu_cxx
+
} // extern "C++"
#endif
diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h
index cee7019169b..ea30ebab8ef 100644
--- a/libstdc++-v3/libsupc++/unwind-cxx.h
+++ b/libstdc++-v3/libsupc++/unwind-cxx.h
@@ -105,7 +105,7 @@ extern "C" void __cxa_throw (void *thrown_exception,
__attribute__((noreturn));
// Used to implement exception handlers.
-extern "C" void *__cxa_begin_catch (_Unwind_Exception *) throw();
+extern "C" void *__cxa_begin_catch (void *) throw();
extern "C" void __cxa_end_catch ();
extern "C" void __cxa_rethrow () __attribute__((noreturn));
@@ -118,8 +118,7 @@ extern "C" void __cxa_bad_typeid ();
// Handles re-checking the exception specification if unexpectedHandler
// throws, and if bad_exception needs to be thrown. Called from the
// compiler.
-extern "C" void __cxa_call_unexpected (_Unwind_Exception *)
- __attribute__((noreturn));
+extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
// Invokes given handler, dying appropriately if the user handler was
// so inconsiderate as to return.
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 4fa5f82da16..b32359deae4 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -65,9 +65,9 @@ sources = \
locale.cc locale-inst.cc localename.cc \
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
- valarray-inst.cc wstring-inst.cc concept-inst.cc
+ valarray-inst.cc wstring-inst.cc concept-inst.cc vterminate.cc
-VPATH = $(top_srcdir):$(top_srcdir)/src
+VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
@@ -84,9 +84,9 @@ libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
# deprecated include files.
GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
# Use special rules for the concept-checking instantiations so that all
# the generated template functions are also instantiated. Force the checks
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index b08c64c3e8a..00b13ae15db 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -190,10 +190,10 @@ sources = \
locale.cc locale-inst.cc localename.cc \
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
- valarray-inst.cc wstring-inst.cc concept-inst.cc
+ valarray-inst.cc wstring-inst.cc concept-inst.cc vterminate.cc
-VPATH = $(top_srcdir):$(top_srcdir)/src
+VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
@@ -268,7 +268,7 @@ codecvt.lo complex_io.lo functexcept.lo globals.lo ios.lo limits.lo \
locale.lo locale-inst.lo localename.lo collate.lo messages.lo \
moneypunct.lo numpunct.lo time.lo misc-inst.lo stdexcept.lo stl-inst.lo \
string-inst.lo strstream.lo valarray-inst.lo wstring-inst.lo \
-concept-inst.lo
+concept-inst.lo vterminate.lo
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
@@ -495,9 +495,9 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
# Use special rules for the concept-checking instantiations so that all
# the generated template functions are also instantiated. Force the checks
diff --git a/libstdc++-v3/src/vterminate.cc b/libstdc++-v3/src/vterminate.cc
new file mode 100644
index 00000000000..c84068a0696
--- /dev/null
+++ b/libstdc++-v3/src/vterminate.cc
@@ -0,0 +1,82 @@
+// Verbose terminate_handler -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU CC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with GNU CC; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// 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;
+using namespace abi;
+
+namespace __gnu_cxx {
+
+/** This is 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