Commit e5dd4aad by Nathan Sidwell Committed by Nathan Sidwell

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
parent 7787480c
2001-02-26 Nathan Sidwell <nathan@codesourcery.com>
* except.c (call_eh_info): Cleanup generation of cp_eh_info struct.
* decl.c (mark_inlined_fns): Prototype.
2001-02-22 Mark Mitchell <mark@codesourcery.com> 2001-02-22 Mark Mitchell <mark@codesourcery.com>
* spew.c (yylex): Correct handling of friends. * spew.c (yylex): Correct handling of friends.
......
...@@ -130,6 +130,7 @@ static void mark_binding_level PARAMS ((void *)); ...@@ -130,6 +130,7 @@ static void mark_binding_level PARAMS ((void *));
static void mark_named_label_lists PARAMS ((void *, void *)); static void mark_named_label_lists PARAMS ((void *, void *));
static void mark_cp_function_context PARAMS ((struct function *)); static void mark_cp_function_context PARAMS ((struct function *));
static void mark_saved_scope PARAMS ((void *)); 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 mark_lang_function PARAMS ((struct cp_language_function *));
static void save_function_data PARAMS ((tree)); static void save_function_data PARAMS ((tree));
static void check_function_type PARAMS ((tree, tree)); static void check_function_type PARAMS ((tree, tree));
......
...@@ -169,62 +169,85 @@ call_eh_info () ...@@ -169,62 +169,85 @@ call_eh_info ()
fn = IDENTIFIER_GLOBAL_VALUE (fn); fn = IDENTIFIER_GLOBAL_VALUE (fn);
else else
{ {
tree t1, t, fields[7]; tree eh_info_type;
tree cleanup_fn_type;
/* Declare cp_eh_info * __start_cp_handler (void), tree matcher_fn_type;
as defined in exception.cc. */ tree cp_eh_info_type;
tree exception_desc_type;
/* struct cp_eh_info. This must match exception.cc. Note that this tree fields[8];
type is not pushed anywhere. */
t1= make_aggr_type (RECORD_TYPE); eh_info_type = make_aggr_type (RECORD_TYPE);
fields[0] = build_decl (FIELD_DECL, exception_desc_type = make_aggr_type (RECORD_TYPE);
get_identifier ("handler_label"), ptr_type_node);
fields[1] = build_decl (FIELD_DECL, /* void * (*) (__eh_info *, void *, exception_descriptor *); */
get_identifier ("dynamic_handler_chain"), ptr_type_node); matcher_fn_type = tree_cons
fields[2] = build_decl (FIELD_DECL, (NULL_TREE, build_pointer_type (eh_info_type), tree_cons
get_identifier ("info"), ptr_type_node); (NULL_TREE, ptr_type_node, tree_cons
fields[3] = build_decl (FIELD_DECL, (NULL_TREE, build_pointer_type (exception_desc_type),
get_identifier ("table_index"), ptr_type_node); void_list_node)));
/* N.B.: The fourth field LEN is expected to be matcher_fn_type = build_function_type (ptr_type_node, matcher_fn_type);
the number of fields - 1, not the total number of fields. */ matcher_fn_type = build_pointer_type (matcher_fn_type);
finish_builtin_type (t1, "eh_context", fields, 3, ptr_type_node);
t1 = build_pointer_type (t1); /* void (*) (void *); */
cleanup_fn_type = tree_cons
t1= make_aggr_type (RECORD_TYPE); (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, 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, fields[1] = build_decl (FIELD_DECL,
get_identifier ("language"), short_integer_type_node); get_identifier ("language"), short_integer_type_node);
fields[2] = build_decl (FIELD_DECL, fields[2] = build_decl (FIELD_DECL,
get_identifier ("version"), short_integer_type_node); get_identifier ("version"), short_integer_type_node);
/* N.B.: The fourth field LEN is expected to be /* N.B.: The fourth field LEN is expected to be
the number of fields - 1, not the total number of fields. */ the number of fields - 1, not the total number of fields. */
finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node); finish_builtin_type (eh_info_type, "__eh_info", fields, 2, ptr_type_node);
t = make_aggr_type (RECORD_TYPE);
fields[0] = build_decl (FIELD_DECL, /* exception_support.h
get_identifier ("eh_info"), t1); 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"), fields[1] = build_decl (FIELD_DECL, get_identifier ("value"),
ptr_type_node); ptr_type_node);
fields[2] = build_decl (FIELD_DECL, get_identifier ("type"), fields[2] = build_decl (FIELD_DECL, get_identifier ("type"),
ptr_type_node); ptr_type_node);
fields[3] = build_decl fields[3] = build_decl (FIELD_DECL, get_identifier ("cleanup"),
(FIELD_DECL, get_identifier ("cleanup"), cleanup_fn_type);
build_pointer_type (build_function_type
(ptr_type_node, tree_cons
(NULL_TREE, ptr_type_node, void_list_node))));
fields[4] = build_decl (FIELD_DECL, get_identifier ("caught"), fields[4] = build_decl (FIELD_DECL, get_identifier ("caught"),
boolean_type_node); boolean_type_node);
fields[5] = build_decl (FIELD_DECL, get_identifier ("next"), fields[5] = build_decl (FIELD_DECL, get_identifier ("next"),
build_pointer_type (t)); build_pointer_type (cp_eh_info_type));
fields[6] = build_decl fields[6] = build_decl (FIELD_DECL, get_identifier ("handlers"),
(FIELD_DECL, get_identifier ("handlers"), long_integer_type_node); 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 /* N.B.: The fourth field LEN is expected to be
the number of fields - 1, not the total number of fields. */ the number of fields - 1, not the total number of fields. */
finish_builtin_type (t, "cp_eh_info", fields, 6, ptr_type_node); finish_builtin_type (cp_eh_info_type, "cp_eh_info", fields, 7, ptr_type_node);
t = build_pointer_type (t);
/* And now the function. */ /* 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); return build_function_call (fn, NULL_TREE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment