From e5dd4aad7f83c3257f4302e100b31690000e1a26 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 26 Feb 2001 11:01:44 +0000 Subject: [PATCH] except.c (call_eh_info): Cleanup generation of cp_eh_info struct. * except.c (call_eh_info): Cleanup generation of cp_eh_info struct. * decl.c (mark_inlined_fns): Prototype. From-SVN: r40065 --- gcc/cp/ChangeLog | 6 +++ gcc/cp/decl.c | 1 + gcc/cp/except.c | 99 +++++++++++++++++++++++++++++------------------- 3 files changed, 68 insertions(+), 38 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0bb8645667a..ede5dc12f50 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-02-26 Nathan Sidwell + + * except.c (call_eh_info): Cleanup generation of cp_eh_info struct. + + * decl.c (mark_inlined_fns): Prototype. + 2001-02-22 Mark Mitchell * spew.c (yylex): Correct handling of friends. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 39008956f4a..941f95a81b1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -130,6 +130,7 @@ static void mark_binding_level PARAMS ((void *)); static void mark_named_label_lists PARAMS ((void *, void *)); static void mark_cp_function_context PARAMS ((struct function *)); static void mark_saved_scope PARAMS ((void *)); +static void mark_inlined_fns PARAMS ((struct lang_decl_inlined_fns *)); static void mark_lang_function PARAMS ((struct cp_language_function *)); static void save_function_data PARAMS ((tree)); static void check_function_type PARAMS ((tree, tree)); diff --git a/gcc/cp/except.c b/gcc/cp/except.c index e53582100e3..9d3a6a5f7bd 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -169,62 +169,85 @@ call_eh_info () fn = IDENTIFIER_GLOBAL_VALUE (fn); else { - tree t1, t, fields[7]; - - /* Declare cp_eh_info * __start_cp_handler (void), - as defined in exception.cc. */ - - /* struct cp_eh_info. This must match exception.cc. Note that this - type is not pushed anywhere. */ - t1= make_aggr_type (RECORD_TYPE); - fields[0] = build_decl (FIELD_DECL, - get_identifier ("handler_label"), ptr_type_node); - fields[1] = build_decl (FIELD_DECL, - get_identifier ("dynamic_handler_chain"), ptr_type_node); - fields[2] = build_decl (FIELD_DECL, - get_identifier ("info"), ptr_type_node); - fields[3] = build_decl (FIELD_DECL, - get_identifier ("table_index"), ptr_type_node); - /* N.B.: The fourth field LEN is expected to be - the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t1, "eh_context", fields, 3, ptr_type_node); - t1 = build_pointer_type (t1); - - t1= make_aggr_type (RECORD_TYPE); + tree eh_info_type; + tree cleanup_fn_type; + tree matcher_fn_type; + tree cp_eh_info_type; + tree exception_desc_type; + tree fields[8]; + + eh_info_type = make_aggr_type (RECORD_TYPE); + exception_desc_type = make_aggr_type (RECORD_TYPE); + + /* void * (*) (__eh_info *, void *, exception_descriptor *); */ + matcher_fn_type = tree_cons + (NULL_TREE, build_pointer_type (eh_info_type), tree_cons + (NULL_TREE, ptr_type_node, tree_cons + (NULL_TREE, build_pointer_type (exception_desc_type), + void_list_node))); + matcher_fn_type = build_function_type (ptr_type_node, matcher_fn_type); + matcher_fn_type = build_pointer_type (matcher_fn_type); + + /* void (*) (void *); */ + cleanup_fn_type = tree_cons + (NULL_TREE, ptr_type_node, void_list_node); + cleanup_fn_type = build_function_type (void_type_node, cleanup_fn_type); + cleanup_fn_type = build_pointer_type (cleanup_fn_type); + + /* eh-common.h + struct __eh_info + { + __eh_matcher match_function; + short language; + short version; + }; */ fields[0] = build_decl (FIELD_DECL, - get_identifier ("match_function"), ptr_type_node); + get_identifier ("match_function"), matcher_fn_type); fields[1] = build_decl (FIELD_DECL, get_identifier ("language"), short_integer_type_node); fields[2] = build_decl (FIELD_DECL, get_identifier ("version"), short_integer_type_node); /* N.B.: The fourth field LEN is expected to be the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node); - t = make_aggr_type (RECORD_TYPE); - fields[0] = build_decl (FIELD_DECL, - get_identifier ("eh_info"), t1); + finish_builtin_type (eh_info_type, "__eh_info", fields, 2, ptr_type_node); + + /* exception_support.h + struct cp_eh_info + { + __eh_info eh_info; + void *value; + void *type; + cleanup_fn cleanup; + bool caught; + cp_eh_info *next; + long handlers; + void *original_value; + }; */ + cp_eh_info_type = make_aggr_type (RECORD_TYPE); + fields[0] = build_decl (FIELD_DECL, get_identifier ("eh_info"), + eh_info_type); fields[1] = build_decl (FIELD_DECL, get_identifier ("value"), ptr_type_node); fields[2] = build_decl (FIELD_DECL, get_identifier ("type"), ptr_type_node); - fields[3] = build_decl - (FIELD_DECL, get_identifier ("cleanup"), - build_pointer_type (build_function_type - (ptr_type_node, tree_cons - (NULL_TREE, ptr_type_node, void_list_node)))); + fields[3] = build_decl (FIELD_DECL, get_identifier ("cleanup"), + cleanup_fn_type); fields[4] = build_decl (FIELD_DECL, get_identifier ("caught"), boolean_type_node); fields[5] = build_decl (FIELD_DECL, get_identifier ("next"), - build_pointer_type (t)); - fields[6] = build_decl - (FIELD_DECL, get_identifier ("handlers"), long_integer_type_node); + build_pointer_type (cp_eh_info_type)); + fields[6] = build_decl (FIELD_DECL, get_identifier ("handlers"), + long_integer_type_node); + fields[7] = build_decl (FIELD_DECL, get_identifier ("original_value"), + ptr_type_node); /* N.B.: The fourth field LEN is expected to be the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t, "cp_eh_info", fields, 6, ptr_type_node); - t = build_pointer_type (t); + finish_builtin_type (cp_eh_info_type, "cp_eh_info", fields, 7, ptr_type_node); /* And now the function. */ - fn = push_library_fn (fn, build_function_type (t, void_list_node)); + fn = push_library_fn (fn, + build_function_type (build_pointer_type (cp_eh_info_type), + void_list_node)); } return build_function_call (fn, NULL_TREE); } -- 2.30.2