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
This commit is contained in:
Jason Merrill 1999-01-25 20:43:21 +00:00 committed by Jason Merrill
parent 89ae2c8c42
commit a6ecf8b605
7 changed files with 41 additions and 21 deletions

View File

@ -1,3 +1,19 @@
1999-01-25 Jason Merrill <jason@yorick.cygnus.com>
* 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 <loewis@informatik.hu-berlin.de> 1999-01-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
* tree.c (equal_functions): New function. * tree.c (equal_functions): New function.

View File

@ -1,5 +1,5 @@
/* Functions related to invoking methods and overloaded functions. /* 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 Contributed by Michael Tiemann (tiemann@cygnus.com) and
modified by Brendan Kehoe (brendan@cygnus.com). modified by Brendan Kehoe (brendan@cygnus.com).
@ -552,6 +552,9 @@ build_call (function, result_type, parms)
if (decl && DECL_CONSTRUCTOR_P (decl)) if (decl && DECL_CONSTRUCTOR_P (decl))
is_constructor = 1; is_constructor = 1;
if (decl)
my_friendly_assert (TREE_USED (decl), 990125);
/* Don't pass empty class objects by value. This is useful /* Don't pass empty class objects by value. This is useful
for tags in STL, which are used to control overload resolution. for tags in STL, which are used to control overload resolution.
We don't need to handle other cases of copying empty classes. */ We don't need to handle other cases of copying empty classes. */

View File

@ -5229,6 +5229,8 @@ resolve_address_of_overloaded_function (target_type,
/* Good, exactly one match. Now, convert it to the correct type. */ /* Good, exactly one match. Now, convert it to the correct type. */
fn = TREE_PURPOSE (matches); fn = TREE_PURPOSE (matches);
mark_used (fn);
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
return build_unary_op (ADDR_EXPR, fn, 0); return build_unary_op (ADDR_EXPR, fn, 0);
else else

View File

@ -8147,7 +8147,7 @@ expand_static_init (decl, init)
build_function_type (void_type_node, build_function_type (void_type_node,
pfvlist), pfvlist),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
assemble_external (atexit_fndecl); mark_used (atexit_fndecl);
Atexit = default_conversion (atexit_fndecl); Atexit = default_conversion (atexit_fndecl);
pop_lang_context (); pop_lang_context ();
pop_obstacks (); pop_obstacks ();

View File

@ -1,5 +1,5 @@
/* Handle exceptional things in C++. /* 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 <tiemann@cygnus.com> Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt. initial re-implementation courtesy Tad Hunt.
@ -318,9 +318,9 @@ call_eh_info ()
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
return build_function_call (fn, NULL_TREE); return build_function_call (fn, NULL_TREE);
} }
@ -531,10 +531,10 @@ do_pop_exception ()
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
/* Arrange to do a dynamically scoped cleanup upon exit from this region. */ /* Arrange to do a dynamically scoped cleanup upon exit from this region. */
cleanup = lookup_name (get_identifier ("__exception_info"), 0); cleanup = lookup_name (get_identifier ("__exception_info"), 0);
cleanup = build_function_call (fn, expr_tree_cons cleanup = build_function_call (fn, expr_tree_cons
@ -797,10 +797,10 @@ expand_end_eh_spec (raises)
TREE_THIS_VOLATILE (fn) = 1; TREE_THIS_VOLATILE (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
tmp = expr_tree_cons (NULL_TREE, build_int_2 (count, 0), expr_tree_cons tmp = expr_tree_cons (NULL_TREE, build_int_2 (count, 0), expr_tree_cons
(NULL_TREE, decl, NULL_TREE)); (NULL_TREE, decl, NULL_TREE));
tmp = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), tmp); tmp = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), tmp);
@ -939,10 +939,10 @@ alloc_eh_object (type)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
exp = build_function_call (fn, expr_tree_cons exp = build_function_call (fn, expr_tree_cons
(NULL_TREE, size_in_bytes (type), NULL_TREE)); (NULL_TREE, size_in_bytes (type), NULL_TREE));
exp = build1 (NOP_EXPR, build_pointer_type (type), exp); exp = build1 (NOP_EXPR, build_pointer_type (type), exp);
@ -1096,10 +1096,10 @@ expand_throw (exp)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
e = expr_tree_cons (NULL_TREE, exp, expr_tree_cons e = expr_tree_cons (NULL_TREE, exp, expr_tree_cons
(NULL_TREE, throw_type, expr_tree_cons (NULL_TREE, throw_type, expr_tree_cons
(NULL_TREE, cleanup, NULL_TREE))); (NULL_TREE, cleanup, NULL_TREE)));
@ -1127,10 +1127,10 @@ expand_throw (exp)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
exp = build_function_call (fn, NULL_TREE); exp = build_function_call (fn, NULL_TREE);
expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL); expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
} }

View File

@ -1,5 +1,5 @@
/* Handle initialization things in C++. /* 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) Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC. This file is part of GNU CC.
@ -1861,7 +1861,7 @@ static tree
build_builtin_delete_call (addr) build_builtin_delete_call (addr)
tree addr; tree addr;
{ {
assemble_external (global_delete_fndecl); mark_used (global_delete_fndecl);
return build_call (global_delete_fndecl, return build_call (global_delete_fndecl,
void_type_node, build_expr_list (NULL_TREE, addr)); void_type_node, build_expr_list (NULL_TREE, addr));
} }

View File

@ -1,5 +1,5 @@
/* RunTime Type Identification /* 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). Mostly written by Jason Merrill (jason@cygnus.com).
This file is part of GNU CC. This file is part of GNU CC.
@ -151,11 +151,10 @@ call_void_fn (name)
DECL_ARTIFICIAL (d) = 1; DECL_ARTIFICIAL (d) = 1;
pushdecl_top_level (d); pushdecl_top_level (d);
make_function_rtl (d); make_function_rtl (d);
assemble_external (d);
pop_obstacks (); pop_obstacks ();
} }
mark_used (d);
return build_call (d, void_type_node, NULL_TREE); return build_call (d, void_type_node, NULL_TREE);
} }
@ -377,7 +376,7 @@ get_tinfo_fn (type)
pushdecl_top_level (d); pushdecl_top_level (d);
make_function_rtl (d); make_function_rtl (d);
assemble_external (d); mark_used (d);
mark_inline_for_output (d); mark_inline_for_output (d);
pop_obstacks (); pop_obstacks ();
@ -653,10 +652,10 @@ build_dynamic_cast_1 (type, expr)
DECL_ARTIFICIAL (dcast_fn) = 1; DECL_ARTIFICIAL (dcast_fn) = 1;
pushdecl_top_level (dcast_fn); pushdecl_top_level (dcast_fn);
make_function_rtl (dcast_fn); make_function_rtl (dcast_fn);
assemble_external (dcast_fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (dcast_fn);
result = build_call result = build_call
(dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems); (dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems);
@ -751,10 +750,10 @@ expand_si_desc (tdecl, type)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn); expand_expr_stmt (fn);
} }
@ -932,10 +931,10 @@ expand_class_desc (tdecl, type)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn); expand_expr_stmt (fn);
} }
@ -979,10 +978,10 @@ expand_ptr_desc (tdecl, type)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn); expand_expr_stmt (fn);
} }
@ -1027,10 +1026,10 @@ expand_attr_desc (tdecl, type)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn); expand_expr_stmt (fn);
} }
@ -1067,10 +1066,10 @@ expand_generic_desc (tdecl, type, fnname)
DECL_ARTIFICIAL (fn) = 1; DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn); pushdecl_top_level (fn);
make_function_rtl (fn); make_function_rtl (fn);
assemble_external (fn);
pop_obstacks (); pop_obstacks ();
} }
mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems); fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn); expand_expr_stmt (fn);
} }