From d267eaf55d7e3e56d51dda46736ce54ee4c58d70 Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 10 Mar 2000 09:25:45 +0000 Subject: * decl.c (push_overloaded_decl_1, auto_function, define_function): Lose. (build_library_fn_1): New static fn. (builtin_function): Use it. (get_atexit_node): Use build_library_fn_ptr. (build_library_fn, build_cp_library_fn, build_library_fn_ptr, build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn, push_void_library_fn, push_throw_library_fn): New fns. * cp-tree.h: Declare them. (cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID. (throw_bad_cast_node, throw_bad_typeid_node): Lose. * except.c (init_exception_processing, call_eh_info, do_pop_exception, (expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns. * rtti.c (build_runtime_decl): Lose. (throw_bad_cast, throw_bad_typeid, get_tinfo_decl, build_dynamic_cast_1, expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns. * call.c (build_call): Remove result_type parm. Call mark_used on unused artificial fns. * init.c, method.c, typeck.c, except.c, rtti.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32468 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/except.c | 94 ++++++++++++--------------------------------------------- 1 file changed, 20 insertions(+), 74 deletions(-) (limited to 'gcc/cp/except.c') diff --git a/gcc/cp/except.c b/gcc/cp/except.c index b8d4fa2e709..ae64e78b3d6 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -173,8 +173,9 @@ init_exception_processing () if (flag_honor_std) push_namespace (get_identifier ("std")); - terminate_node = auto_function (get_identifier ("terminate"), vtype); + terminate_node = build_cp_library_fn_ptr ("terminate", vtype); TREE_THIS_VOLATILE (terminate_node) = 1; + TREE_NOTHROW (terminate_node) = 1; if (flag_honor_std) pop_namespace (); @@ -253,16 +254,8 @@ call_eh_info () t = build_pointer_type (t); /* And now the function. */ - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (t, void_list_node)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - TREE_NOTHROW (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + fn = push_library_fn (fn, build_function_type (t, void_list_node)); } - mark_used (fn); return build_function_call (fn, NULL_TREE); } @@ -424,18 +417,12 @@ do_pop_exception () { /* Declare void __cp_pop_exception (void *), as defined in exception.cc. */ - fn = build_lang_decl - (FUNCTION_DECL, fn, - build_function_type (void_type_node, tree_cons - (NULL_TREE, ptr_type_node, void_list_node))); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + fn = push_void_library_fn + (fn, tree_cons (NULL_TREE, ptr_type_node, void_list_node)); + /* This can throw if the destructor for the exception throws. */ + TREE_NOTHROW (fn) = 0; } - mark_used (fn); /* Arrange to do a dynamically scoped cleanup upon exit from this region. */ cleanup = lookup_name (get_identifier ("__exception_info"), 0); cleanup = build_function_call (fn, tree_cons @@ -732,21 +719,13 @@ expand_end_eh_spec (raises, try_block) tmp = tree_cons (NULL_TREE, integer_type_node, tree_cons (NULL_TREE, TREE_TYPE (decl), void_list_node)); - tmp = build_function_type (void_type_node, tmp); - - fn = build_lang_decl (FUNCTION_DECL, fn, tmp); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - TREE_THIS_VOLATILE (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + + fn = push_throw_library_fn (fn, tmp); } - mark_used (fn); tmp = tree_cons (NULL_TREE, build_int_2 (count, 0), tree_cons (NULL_TREE, decl, NULL_TREE)); - tmp = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), tmp); + tmp = build_call (fn, tmp); finish_expr_stmt (tmp); finish_handler (blocks, handler); @@ -799,19 +778,10 @@ alloc_eh_object (type) else { /* Declare __eh_alloc (size_t), as defined in exception.cc. */ - tree tmp; - tmp = tree_cons (NULL_TREE, sizetype, void_list_node); - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (ptr_type_node, tmp)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - TREE_NOTHROW (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + tree tmp = tree_cons (NULL_TREE, sizetype, void_list_node); + fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp)); } - mark_used (fn); exp = build_function_call (fn, tree_cons (NULL_TREE, size_in_bytes (type), NULL_TREE)); exp = build1 (NOP_EXPR, build_pointer_type (type), exp); @@ -852,16 +822,11 @@ expand_throw (exp) { /* Declare _Jv_Throw (void *), as defined in Java's exception.cc. */ - tree tmp; - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (ptr_type_node, tmp)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; + tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + tmp = build_function_type (ptr_type_node, tmp); + fn = push_library_fn (fn, tmp); TREE_THIS_VOLATILE (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + TREE_NOTHROW (fn) = 0; } exp = build_function_call (fn, args); @@ -974,17 +939,9 @@ expand_throw (exp) (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, cleanup_type, void_list_node))); - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (void_type_node, tmp)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - TREE_NOTHROW (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); + fn = push_void_library_fn (fn, tmp); } - mark_used (fn); e = tree_cons (NULL_TREE, exp, tree_cons (NULL_TREE, throw_type, tree_cons (NULL_TREE, cleanup, NULL_TREE))); @@ -1000,21 +957,10 @@ expand_throw (exp) if (IDENTIFIER_GLOBAL_VALUE (fn)) fn = IDENTIFIER_GLOBAL_VALUE (fn); else - { - /* Declare void __uncatch_exception (void) - as defined in exception.cc. */ - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (void_type_node, - void_list_node)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - TREE_NOTHROW (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); - } + /* Declare void __uncatch_exception (void) + as defined in exception.cc. */ + fn = push_void_library_fn (fn, void_list_node); - mark_used (fn); exp = build_function_call (fn, NULL_TREE); } -- cgit v1.2.1