mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-04 17:40:25 +08:00
exception.cc (__cp_pop_exception): If we aren't popping or rethrowing, push down past any uncaught exceptions.
* exception.cc (__cp_pop_exception): If we aren't popping or rethrowing, push down past any uncaught exceptions. (__uncatch_exception): Rethrow the currently handled exception. Move it to the top of the exception stack. From-SVN: r34375
This commit is contained in:
parent
de695d2c6d
commit
6a83e470e7
@ -1,3 +1,10 @@
|
||||
2000-06-02 Jason Merrill <jason@casey.soma.redhat.com>
|
||||
|
||||
* exception.cc (__cp_pop_exception): If we aren't popping or
|
||||
rethrowing, push down past any uncaught exceptions.
|
||||
(__uncatch_exception): Rethrow the currently handled exception.
|
||||
Move it to the top of the exception stack.
|
||||
|
||||
Fri Jun 2 19:38:57 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* cp-tree.h: Use struct tree_common instead of a char array.
|
||||
|
@ -247,17 +247,37 @@ __cp_push_exception (void *value, void *type, cleanup_fn cleanup)
|
||||
extern "C" void
|
||||
__cp_pop_exception (cp_eh_info *p)
|
||||
{
|
||||
cp_eh_info **q = __get_eh_info ();
|
||||
cp_eh_info **stack = __get_eh_info ();
|
||||
cp_eh_info **q = stack;
|
||||
|
||||
--p->handlers;
|
||||
|
||||
/* Don't really pop if there are still active handlers for our exception,
|
||||
or if our exception is being rethrown (i.e. if the active exception is
|
||||
our exception and it is uncaught). */
|
||||
if (p->handlers != 0
|
||||
|| (p == *q && !p->caught))
|
||||
/* Do nothing if our exception is being rethrown (i.e. if the active
|
||||
exception is our exception and it is uncaught). */
|
||||
if (p == *q && !p->caught)
|
||||
return;
|
||||
|
||||
/* Don't really pop if there are still active handlers for our exception;
|
||||
rather, push it down past any uncaught exceptions. */
|
||||
if (p->handlers != 0)
|
||||
{
|
||||
if (p == *q && p->next && !p->next->caught)
|
||||
{
|
||||
q = &(p->next);
|
||||
while (1)
|
||||
{
|
||||
if (*q == 0 || (*q)->caught)
|
||||
break;
|
||||
|
||||
q = &((*q)->next);
|
||||
}
|
||||
*stack = p->next;
|
||||
p->next = *q;
|
||||
*q = p;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (; *q; q = &((*q)->next))
|
||||
if (*q == p)
|
||||
break;
|
||||
@ -277,12 +297,35 @@ __cp_pop_exception (cp_eh_info *p)
|
||||
__eh_free (p);
|
||||
}
|
||||
|
||||
/* We're doing a rethrow. Find the currently handled exception, mark it
|
||||
uncaught, and move it to the top of the EH stack. */
|
||||
|
||||
extern "C" void
|
||||
__uncatch_exception (void)
|
||||
{
|
||||
cp_eh_info *p = CP_EH_INFO;
|
||||
if (p == 0)
|
||||
terminate ();
|
||||
cp_eh_info **stack = __get_eh_info ();
|
||||
cp_eh_info **q = stack;
|
||||
cp_eh_info *p;
|
||||
|
||||
while (1)
|
||||
{
|
||||
p = *q;
|
||||
|
||||
if (p == 0)
|
||||
terminate ();
|
||||
if (p->caught)
|
||||
break;
|
||||
|
||||
q = &(p->next);
|
||||
}
|
||||
|
||||
if (q != stack)
|
||||
{
|
||||
*q = p->next;
|
||||
p->next = *stack;
|
||||
*stack = p;
|
||||
}
|
||||
|
||||
p->caught = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user