diff options
Diffstat (limited to 'contrib/gcc/cp/exception.cc')
-rw-r--r-- | contrib/gcc/cp/exception.cc | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/contrib/gcc/cp/exception.cc b/contrib/gcc/cp/exception.cc index 4c10404..8e8f35f 100644 --- a/contrib/gcc/cp/exception.cc +++ b/contrib/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, @@ -157,7 +174,9 @@ __cplus_type_matcher (cp_eh_info *info, rtimetype match_info, { void *ret; - if (exception_table->lang.language != EH_LANG_C_plus_plus) + /* No exception table implies the old style mechanism, so don't check. */ + if (exception_table != NULL + && exception_table->lang.language != EH_LANG_C_plus_plus) return NULL; if (match_info == CATCH_ALL_TYPE) @@ -231,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); } @@ -239,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; @@ -260,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) { @@ -313,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; } |