summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/libsupc++/eh_throw.cc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-07 22:50:42 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-07 22:50:42 +0000
commitd6d31e2de5a5a043328219ba8b14e7422e18f95f (patch)
treec60d6aa70fbdd55088e82c165c1341adb947d48c /libstdc++-v3/libsupc++/eh_throw.cc
parent551033af3b1cb253a790d299e5fcddd5571a9e78 (diff)
downloadppe42-gcc-d6d31e2de5a5a043328219ba8b14e7422e18f95f.tar.gz
ppe42-gcc-d6d31e2de5a5a043328219ba8b14e7422e18f95f.zip
PR libstdc++/38732
* libsupc++/unwind-cxx.h (__cxxabiv1::__cxa_exception): Remove referenceCount field again. (__cxxabiv1::__cxa_refcounted_exception): New struct. (__cxxabiv1::__get_refcounted_exception_header_from_obj, __cxxabiv1::__get_refcounted_exception_header_from_ue): New static inline functions. * libsupc++/eh_alloc.cc (__cxxabiv1::__cxa_allocate_exception, __cxxabiv1::__cxa_free_exception): Use __cxa_refcounted_exception instead of __cxa_exception. * libsupc++/eh_throw.cc (__gxx_exception_cleanup, __cxxabiv1::__cxa_throw): Likewise. * libsupc++/eh_ptr.cc (std::rethrow_exception, std::__exception_ptr::exception_ptr::_M_addref, std::__exception_ptr::exception_ptr::_M_release, __gxx_dependent_exception_cleanup): Likewise. * testsuite/18_support/exception/38732.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143170 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_throw.cc')
-rw-r--r--libstdc++-v3/libsupc++/eh_throw.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index 24b357772b4..afe7c683c5b 100644
--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for throwing.
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
// Free Software Foundation, Inc.
//
// This file is part of GCC.
@@ -38,21 +38,22 @@ static void
__gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
{
// This cleanup is set only for primaries.
- __cxa_exception *header = __get_exception_header_from_ue (exc);
+ __cxa_refcounted_exception *header
+ = __get_refcounted_exception_header_from_ue (exc);
// We only want to be called through _Unwind_DeleteException.
// _Unwind_DeleteException in the HP-UX IA64 libunwind library
// returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT
// like the GCC _Unwind_DeleteException function does.
if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
- __terminate (header->terminateHandler);
+ __terminate (header->exc.terminateHandler);
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
if (__sync_sub_and_fetch (&header->referenceCount, 1) == 0)
{
#endif
- if (header->exceptionDestructor)
- header->exceptionDestructor (header + 1);
+ if (header->exc.exceptionDestructor)
+ header->exc.exceptionDestructor (header + 1);
__cxa_free_exception (header + 1);
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
@@ -66,23 +67,24 @@ __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo,
void (*dest) (void *))
{
// Definitely a primary.
- __cxa_exception *header = __get_exception_header_from_obj (obj);
+ __cxa_refcounted_exception *header
+ = __get_refcounted_exception_header_from_obj (obj);
header->referenceCount = 1;
- header->exceptionType = tinfo;
- header->exceptionDestructor = dest;
- header->unexpectedHandler = __unexpected_handler;
- header->terminateHandler = __terminate_handler;
- __GXX_INIT_PRIMARY_EXCEPTION_CLASS(header->unwindHeader.exception_class);
- header->unwindHeader.exception_cleanup = __gxx_exception_cleanup;
+ header->exc.exceptionType = tinfo;
+ header->exc.exceptionDestructor = dest;
+ header->exc.unexpectedHandler = __unexpected_handler;
+ header->exc.terminateHandler = __terminate_handler;
+ __GXX_INIT_PRIMARY_EXCEPTION_CLASS(header->exc.unwindHeader.exception_class);
+ header->exc.unwindHeader.exception_cleanup = __gxx_exception_cleanup;
#ifdef _GLIBCXX_SJLJ_EXCEPTIONS
- _Unwind_SjLj_RaiseException (&header->unwindHeader);
+ _Unwind_SjLj_RaiseException (&header->exc.unwindHeader);
#else
- _Unwind_RaiseException (&header->unwindHeader);
+ _Unwind_RaiseException (&header->exc.unwindHeader);
#endif
// Some sort of unwinding error. Note that terminate is a handler.
- __cxa_begin_catch (&header->unwindHeader);
+ __cxa_begin_catch (&header->exc.unwindHeader);
std::terminate ();
}
OpenPOWER on IntegriCloud