OSDN Git Service

* tree-into-ssa.c: Re-organize internal functions.
[pf3gnuchains/gcc-fork.git] / gcc / unwind.inc
index 225b046..683e94a 100644 (file)
@@ -1,5 +1,5 @@
 /* Exception handling and frame unwind runtime interface routines. -*- C -*-
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -8,6 +8,15 @@
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
+   In addition to the permissions in the GNU General Public License, the
+   Free Software Foundation gives you unlimited permission to link the
+   compiled version of this file into combinations with other programs,
+   and to distribute those combinations without any restriction coming
+   from the use of this file.  (The General Public License restrictions
+   do apply in other respects; for example, they cover modification of
+   the file, and distribution when not linked into a combined
+   executable.)
+
    GCC 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
@@ -232,12 +241,40 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
   uw_install_context (&this_context, &cur_context);
 }
 
+
+/* Resume propagation of an FORCE_UNWIND exception, or to rethrow
+   a normal exception that was handled.  */
+
+_Unwind_Reason_Code
+_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
+{
+  struct _Unwind_Context this_context, cur_context;
+  _Unwind_Reason_Code code;
+
+  /* Choose between continuing to process _Unwind_RaiseException
+     or _Unwind_ForcedUnwind.  */
+  if (exc->private_1 == 0)
+    return _Unwind_RaiseException (exc);
+
+  uw_init_context (&this_context);
+  cur_context = this_context;
+
+  code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
+
+  if (code != _URC_INSTALL_CONTEXT)
+    abort ();
+
+  uw_install_context (&this_context, &cur_context);
+}
+
+
 /* A convenience function that calls the exception_cleanup field.  */
 
 void
 _Unwind_DeleteException (struct _Unwind_Exception *exc)
 {
-  (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc);
+  if (exc->exception_cleanup)
+    (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc);
 }
 
 
@@ -274,4 +311,3 @@ _Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument)
 
   return code;
 }
-