From a6ecf8b60582b7d7ca7f9c24730db831aea6658e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 25 Jan 1999 20:43:21 +0000 Subject: [PATCH] class.c (resolve_address_of_overloaded_function): Mark the chosen function used. * class.c (resolve_address_of_overloaded_function): Mark the chosen function used. * call.c (build_call): Make sure that a function coming in has been marked used already. * decl.c (expand_static_init): Call mark_used instead of assemble_external. * except.c (call_eh_info, do_pop_exception, expand_end_eh_spec, alloc_eh_object, expand_throw): Likewise. * init.c (build_builtin_delete_call): Likewise. * rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1, expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise. From-SVN: r24862 --- gcc/cp/ChangeLog | 16 ++++++++++++++++ gcc/cp/call.c | 5 ++++- gcc/cp/class.c | 2 ++ gcc/cp/decl.c | 2 +- gcc/cp/except.c | 14 +++++++------- gcc/cp/init.c | 4 ++-- gcc/cp/rtti.c | 19 +++++++++---------- 7 files changed, 41 insertions(+), 21 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 95e47671489..a3798926d6f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,19 @@ +1999-01-25 Jason Merrill + + * class.c (resolve_address_of_overloaded_function): Mark the + chosen function used. + + * call.c (build_call): Make sure that a function coming in has + been marked used already. + * decl.c (expand_static_init): Call mark_used instead of + assemble_external. + * except.c (call_eh_info, do_pop_exception, expand_end_eh_spec, + alloc_eh_object, expand_throw): Likewise. + * init.c (build_builtin_delete_call): Likewise. + * rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1, + expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc, + expand_generic_desc): Likewise. + 1999-01-25 Martin von Löwis * tree.c (equal_functions): New function. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 3891ea75b7e..c478a500140 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1,5 +1,5 @@ /* Functions related to invoking methods and overloaded functions. - Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc. + Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) and modified by Brendan Kehoe (brendan@cygnus.com). @@ -552,6 +552,9 @@ build_call (function, result_type, parms) if (decl && DECL_CONSTRUCTOR_P (decl)) is_constructor = 1; + if (decl) + my_friendly_assert (TREE_USED (decl), 990125); + /* Don't pass empty class objects by value. This is useful for tags in STL, which are used to control overload resolution. We don't need to handle other cases of copying empty classes. */ diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 2e6022bc702..1430b9e6068 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5229,6 +5229,8 @@ resolve_address_of_overloaded_function (target_type, /* Good, exactly one match. Now, convert it to the correct type. */ fn = TREE_PURPOSE (matches); + mark_used (fn); + if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) return build_unary_op (ADDR_EXPR, fn, 0); else diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d62263211b9..927eec61ccc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8147,7 +8147,7 @@ expand_static_init (decl, init) build_function_type (void_type_node, pfvlist), NOT_BUILT_IN, NULL_PTR); - assemble_external (atexit_fndecl); + mark_used (atexit_fndecl); Atexit = default_conversion (atexit_fndecl); pop_lang_context (); pop_obstacks (); diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 2216a787633..aa1ff92769c 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1,5 +1,5 @@ /* Handle exceptional things in C++. - Copyright (C) 1989, 92-97, 1998 Free Software Foundation, Inc. + Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc. Contributed by Michael Tiemann Rewritten by Mike Stump , based upon an initial re-implementation courtesy Tad Hunt. @@ -318,9 +318,9 @@ call_eh_info () DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); return build_function_call (fn, NULL_TREE); } @@ -531,10 +531,10 @@ do_pop_exception () DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + 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, expr_tree_cons @@ -797,10 +797,10 @@ expand_end_eh_spec (raises) TREE_THIS_VOLATILE (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); tmp = expr_tree_cons (NULL_TREE, build_int_2 (count, 0), expr_tree_cons (NULL_TREE, decl, NULL_TREE)); tmp = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), tmp); @@ -939,10 +939,10 @@ alloc_eh_object (type) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); exp = build_function_call (fn, expr_tree_cons (NULL_TREE, size_in_bytes (type), NULL_TREE)); exp = build1 (NOP_EXPR, build_pointer_type (type), exp); @@ -1096,10 +1096,10 @@ expand_throw (exp) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); e = expr_tree_cons (NULL_TREE, exp, expr_tree_cons (NULL_TREE, throw_type, expr_tree_cons (NULL_TREE, cleanup, NULL_TREE))); @@ -1127,10 +1127,10 @@ expand_throw (exp) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); exp = build_function_call (fn, NULL_TREE); expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL); } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index d6898ff13c7..44911ebab79 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1,5 +1,5 @@ /* Handle initialization things in C++. - Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc. + Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -1861,7 +1861,7 @@ static tree build_builtin_delete_call (addr) tree addr; { - assemble_external (global_delete_fndecl); + mark_used (global_delete_fndecl); return build_call (global_delete_fndecl, void_type_node, build_expr_list (NULL_TREE, addr)); } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index fff923063bd..59b2c935420 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1,5 +1,5 @@ /* RunTime Type Identification - Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc. + Copyright (C) 1995, 96-97, 1998, 1999 Free Software Foundation, Inc. Mostly written by Jason Merrill (jason@cygnus.com). This file is part of GNU CC. @@ -151,11 +151,10 @@ call_void_fn (name) DECL_ARTIFICIAL (d) = 1; pushdecl_top_level (d); make_function_rtl (d); - assemble_external (d); - pop_obstacks (); } + mark_used (d); return build_call (d, void_type_node, NULL_TREE); } @@ -377,7 +376,7 @@ get_tinfo_fn (type) pushdecl_top_level (d); make_function_rtl (d); - assemble_external (d); + mark_used (d); mark_inline_for_output (d); pop_obstacks (); @@ -653,10 +652,10 @@ build_dynamic_cast_1 (type, expr) DECL_ARTIFICIAL (dcast_fn) = 1; pushdecl_top_level (dcast_fn); make_function_rtl (dcast_fn); - assemble_external (dcast_fn); pop_obstacks (); } + mark_used (dcast_fn); result = build_call (dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems); @@ -751,10 +750,10 @@ expand_si_desc (tdecl, type) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); expand_expr_stmt (fn); } @@ -932,10 +931,10 @@ expand_class_desc (tdecl, type) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); expand_expr_stmt (fn); } @@ -979,10 +978,10 @@ expand_ptr_desc (tdecl, type) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); expand_expr_stmt (fn); } @@ -1027,10 +1026,10 @@ expand_attr_desc (tdecl, type) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); expand_expr_stmt (fn); } @@ -1067,10 +1066,10 @@ expand_generic_desc (tdecl, type, fnname) DECL_ARTIFICIAL (fn) = 1; pushdecl_top_level (fn); make_function_rtl (fn); - assemble_external (fn); pop_obstacks (); } + mark_used (fn); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); expand_expr_stmt (fn); } -- 2.30.2