OSDN Git Service

PR libstdc++/38732
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / libsupc++ / unwind-cxx.h
index 3f6a765..3e2cf0f 100644 (file)
@@ -1,5 +1,5 @@
 // -*- C++ -*- Exception handling and frame unwind runtime interface routines.
-// 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.
@@ -53,9 +53,6 @@ namespace __cxxabiv1
 
 struct __cxa_exception
 {
-  // Manage this header.
-  _Atomic_word referenceCount;
-
   // Manage the exception object itself.
   std::type_info *exceptionType;
   void (*exceptionDestructor)(void *); 
@@ -92,6 +89,14 @@ struct __cxa_exception
   _Unwind_Exception unwindHeader;
 };
 
+struct __cxa_refcounted_exception
+{
+  // Manage this header.
+  _Atomic_word referenceCount;
+  // __cxa_exception must be last, and no padding can be after it.
+  __cxa_exception exc;
+};
+
 // A dependent C++ exception object consists of a wrapper around an unwind
 // object header with additional C++ specific information, containing a pointer
 // to a primary exception object.
@@ -227,6 +232,21 @@ __get_exception_header_from_ue (_Unwind_Exception *exc)
   return reinterpret_cast<__cxa_exception *>(exc + 1) - 1;
 }
 
+// Acquire the C++ refcounted exception header from the C++ object.
+static inline __cxa_refcounted_exception *
+__get_refcounted_exception_header_from_obj (void *ptr)
+{
+  return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1;
+}
+
+// Acquire the C++ refcounted exception header from the generic exception
+// header.
+static inline __cxa_refcounted_exception *
+__get_refcounted_exception_header_from_ue (_Unwind_Exception *exc)
+{
+  return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1;
+}
+
 static inline __cxa_dependent_exception *
 __get_dependent_exception_from_ue (_Unwind_Exception *exc)
 {