aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/exception.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/exception.cc')
-rw-r--r--gcc/cp/exception.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/cp/exception.cc b/gcc/cp/exception.cc
index 05b431521cc..8e8f35f50db 100644
--- a/gcc/cp/exception.cc
+++ b/gcc/cp/exception.cc
@@ -1,5 +1,5 @@
// Functions for Exception Support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996, 1998 Free Software Foundation
+// Copyright (C) 1994, 95-97, 1998 Free Software Foundation
// This file is part of GNU CC.
@@ -30,6 +30,7 @@
#include "typeinfo"
#include "exception"
#include <stddef.h>
+#include "gansidecl.h" /* Needed to support macros used in eh-common.h. */
#include "eh-common.h"
/* Define terminate, unexpected, set_terminate, set_unexpected as
@@ -116,13 +117,29 @@ __cp_exception_info (void)
return &((*__get_eh_info ())->value);
}
-/* Compiler hook to return a pointer to the info for the current exception.
+#define CP_EH_INFO ((cp_eh_info *) *__get_eh_info ())
+
+/* Old Compiler hook to return a pointer to the info for the current exception.
Used by get_eh_info (). */
extern "C" cp_eh_info *
__cp_eh_info (void)
{
- return *__get_eh_info ();
+ cp_eh_info *p = CP_EH_INFO;
+ return p;
+}
+
+/* Compiler hook to return a pointer to the info for the current exception,
+ Set the caught bit, and increment the number of handlers that are
+ looking at this exception. This makes handlers smaller. */
+
+extern "C" cp_eh_info *
+__start_cp_handler (void)
+{
+ cp_eh_info *p = CP_EH_INFO;
+ p->caught = 1;
+ p->handlers++;
+ return p;
}
/* Allocate a buffer for a cp_eh_info and an exception object of size SIZE,
@@ -233,7 +250,7 @@ __cp_pop_exception (cp_eh_info *p)
p->cleanup (p->value, 2);
if (! __is_pointer (p->type))
- __eh_free (p->value);
+ __eh_free (p->original_value); // value may have been co-erced.
__eh_free (p);
}
@@ -241,7 +258,7 @@ __cp_pop_exception (cp_eh_info *p)
extern "C" void
__uncatch_exception (void)
{
- cp_eh_info *p = __cp_eh_info ();
+ cp_eh_info *p = CP_EH_INFO;
if (p == 0)
terminate ();
p->caught = false;
@@ -262,7 +279,7 @@ __uncatch_exception (void)
extern "C" void
__check_eh_spec (int n, const void **spec)
{
- cp_eh_info *p = __cp_eh_info ();
+ cp_eh_info *p = CP_EH_INFO;
for (int i = 0; i < n; ++i)
{
@@ -315,7 +332,7 @@ __throw_bad_typeid (void)
bool
std::uncaught_exception ()
{
- cp_eh_info *p = __cp_eh_info ();
+ cp_eh_info *p = CP_EH_INFO;
return p && ! p->caught;
}