diff options
author | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-25 14:11:54 +0000 |
---|---|---|
committer | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-25 14:11:54 +0000 |
commit | a85413a6ac28d432734c514cd140ee039daad06b (patch) | |
tree | bb987eafff1d4601db541283435b2bfed1629fa6 /gcc/except.c | |
parent | 600e851bdb70dfca6f83809e7256c6fb5154a417 (diff) | |
download | gcc-a85413a6ac28d432734c514cd140ee039daad06b.tar.gz |
Thu Jun 25 16:59:18 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
* except.h (CATCH_ALL_TYPE): Definition moved to eh-common.h.
(find_all_handler_type_matches): Add function prototype.
* eh-common.h (CATCH_ALL_TYPE): Definition added.
* except.c (find_all_handler_type_matches): Add function to find all
runtime type info in the exception table.
(output_exception_table_entry): Special case for CATCH_ALL_TYPE.
1998-06-25 Andrew MacLeod <amacleod@cygnus.com>
* cp-tree.h (mark_all_runtime_matches): Add function prototype.
* except.c (mark_all_runtime_matches): Set TREE_SYMBOL_REFERENCED
flag for all function decls which are in the exception table.
* exception.cc (__cplus_type_matcher): Check for CATCH_ALL_TYPE match.
* decl2.c (finish_file): Call mark_all_runtime_matches to make sure
code is emitted for any referenced rtti function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20718 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r-- | gcc/except.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/gcc/except.c b/gcc/except.c index 4c6fd6dfb1f..86871d0eea8 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -787,6 +787,66 @@ void remove_handler (removing_label) } } +/* This function will return a malloc'd pointer to an array of + void pointer representing the runtime match values that + currently exist in all regions. */ + +int +find_all_handler_type_matches (void ***array) +{ + struct handler_info *handler, *last; + int x,y; + void *val; + void **ptr; + int max_ptr; + int n_ptr = 0; + + *array = NULL; + + if (!doing_eh (0) || ! flag_new_exceptions) + return 0; + + max_ptr = 100; + ptr = (void **)malloc (max_ptr * sizeof (void *)); + + if (ptr == NULL) + return 0; + + for (x = 0 ; x < current_func_eh_entry; x++) + { + last = NULL; + handler = function_eh_regions[x].handlers; + for ( ; handler; last = handler, handler = handler->next) + { + val = handler->type_info; + if (val != NULL && val != CATCH_ALL_TYPE) + { + /* See if this match value has already been found. */ + for (y = 0; y < n_ptr; y++) + if (ptr[y] == val) + break; + + /* If we break early, we already found this value. */ + if (y < n_ptr) + continue; + + /* Do we need to allocate more space? */ + if (n_ptr >= max_ptr) + { + max_ptr += max_ptr / 2; + ptr = (void **)realloc (ptr, max_ptr * sizeof (void *)); + if (ptr == NULL) + return 0; + } + ptr[n_ptr] = val; + n_ptr++; + } + } + } + *array = ptr; + return n_ptr; +} + /* Create a new handler structure initialized with the handler label and typeinfo fields passed in. */ @@ -1852,7 +1912,11 @@ output_exception_table_entry (file, n) if (handler->type_info == NULL) assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1); else - output_constant ((tree)(handler->type_info), + if (handler->type_info == CATCH_ALL_TYPE) + assemble_integer (GEN_INT (CATCH_ALL_TYPE), + POINTER_SIZE / BITS_PER_UNIT, 1); + else + output_constant ((tree)(handler->type_info), POINTER_SIZE / BITS_PER_UNIT); } putc ('\n', file); /* blank line */ |