This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) Patch to using behavior
- To: egcs-patches at cygnus dot com
- Subject: (C++) Patch to using behavior
- From: Jason Merrill <jason at cygnus dot com>
- Date: Mon, 25 Jan 1999 20:42:41 -0800
resolve_address_of_overloaded function was failing to call mark_used, which
meant assemble_external wasn't run, so make check in libio broke on the
HP. This patch also adds an assert to avoid this sort of problem in the
future.
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.
Index: call.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/call.c,v
retrieving revision 1.129
diff -c -p -r1.129 call.c
*** call.c 1999/01/21 14:29:24 1.129
--- call.c 1999/01/26 04:40:50
***************
*** 1,5 ****
/* Functions related to invoking methods and overloaded functions.
! Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) and
modified by Brendan Kehoe (brendan@cygnus.com).
--- 1,5 ----
/* Functions related to invoking methods and overloaded functions.
! 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).
*************** build_call (function, result_type, parms
*** 551,556 ****
--- 551,559 ----
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.
Index: class.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/class.c,v
retrieving revision 1.127
diff -c -p -r1.127 class.c
*** class.c 1999/01/18 14:07:28 1.127
--- class.c 1999/01/26 04:40:50
*************** resolve_address_of_overloaded_function (
*** 5229,5234 ****
--- 5229,5236 ----
/* 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
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.301
diff -c -p -r1.301 decl.c
*** decl.c 1999/01/24 15:38:44 1.301
--- decl.c 1999/01/26 04:40:51
*************** expand_static_init (decl, init)
*** 8147,8153 ****
build_function_type (void_type_node,
pfvlist),
NOT_BUILT_IN, NULL_PTR);
! assemble_external (atexit_fndecl);
Atexit = default_conversion (atexit_fndecl);
pop_lang_context ();
pop_obstacks ();
--- 8147,8153 ----
build_function_type (void_type_node,
pfvlist),
NOT_BUILT_IN, NULL_PTR);
! mark_used (atexit_fndecl);
Atexit = default_conversion (atexit_fndecl);
pop_lang_context ();
pop_obstacks ();
Index: except.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/except.c,v
retrieving revision 1.61
diff -c -p -r1.61 except.c
*** except.c 1998/12/22 12:18:12 1.61
--- except.c 1999/01/26 04:40:51
***************
*** 1,5 ****
/* Handle exceptional things in C++.
! Copyright (C) 1989, 92-97, 1998 Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt.
--- 1,5 ----
/* Handle exceptional things in C++.
! Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt.
*************** call_eh_info ()
*** 318,326 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
return build_function_call (fn, NULL_TREE);
}
--- 318,326 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
return build_function_call (fn, NULL_TREE);
}
*************** do_pop_exception ()
*** 531,540 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
/* 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
--- 531,540 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (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
*************** expand_end_eh_spec (raises)
*** 797,806 ****
TREE_THIS_VOLATILE (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
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);
--- 797,806 ----
TREE_THIS_VOLATILE (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (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);
*************** alloc_eh_object (type)
*** 939,948 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
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);
--- 939,948 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (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);
*************** expand_throw (exp)
*** 1096,1105 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
e = expr_tree_cons (NULL_TREE, exp, expr_tree_cons
(NULL_TREE, throw_type, expr_tree_cons
(NULL_TREE, cleanup, NULL_TREE)));
--- 1096,1105 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (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)));
*************** expand_throw (exp)
*** 1127,1136 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
exp = build_function_call (fn, NULL_TREE);
expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
--- 1127,1136 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
exp = build_function_call (fn, NULL_TREE);
expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
Index: init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.85
diff -c -p -r1.85 init.c
*** init.c 1998/12/22 12:18:13 1.85
--- init.c 1999/01/26 04:40:51
***************
*** 1,5 ****
/* Handle initialization things in C++.
! Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
--- 1,5 ----
/* Handle initialization things in C++.
! 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.
*************** static tree
*** 1861,1867 ****
build_builtin_delete_call (addr)
tree addr;
{
! assemble_external (global_delete_fndecl);
return build_call (global_delete_fndecl,
void_type_node, build_expr_list (NULL_TREE, addr));
}
--- 1861,1867 ----
build_builtin_delete_call (addr)
tree addr;
{
! mark_used (global_delete_fndecl);
return build_call (global_delete_fndecl,
void_type_node, build_expr_list (NULL_TREE, addr));
}
Index: rtti.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/rtti.c,v
retrieving revision 1.26
diff -c -p -r1.26 rtti.c
*** rtti.c 1999/01/18 13:32:56 1.26
--- rtti.c 1999/01/26 04:40:51
***************
*** 1,5 ****
/* RunTime Type Identification
! Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc.
Mostly written by Jason Merrill (jason@cygnus.com).
This file is part of GNU CC.
--- 1,5 ----
/* RunTime Type Identification
! 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.
*************** call_void_fn (name)
*** 151,161 ****
DECL_ARTIFICIAL (d) = 1;
pushdecl_top_level (d);
make_function_rtl (d);
- assemble_external (d);
-
pop_obstacks ();
}
return build_call (d, void_type_node, NULL_TREE);
}
--- 151,160 ----
DECL_ARTIFICIAL (d) = 1;
pushdecl_top_level (d);
make_function_rtl (d);
pop_obstacks ();
}
+ mark_used (d);
return build_call (d, void_type_node, NULL_TREE);
}
*************** get_tinfo_fn (type)
*** 377,383 ****
pushdecl_top_level (d);
make_function_rtl (d);
! assemble_external (d);
mark_inline_for_output (d);
pop_obstacks ();
--- 376,382 ----
pushdecl_top_level (d);
make_function_rtl (d);
! mark_used (d);
mark_inline_for_output (d);
pop_obstacks ();
*************** build_dynamic_cast_1 (type, expr)
*** 653,662 ****
DECL_ARTIFICIAL (dcast_fn) = 1;
pushdecl_top_level (dcast_fn);
make_function_rtl (dcast_fn);
- assemble_external (dcast_fn);
pop_obstacks ();
}
result = build_call
(dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems);
--- 652,661 ----
DECL_ARTIFICIAL (dcast_fn) = 1;
pushdecl_top_level (dcast_fn);
make_function_rtl (dcast_fn);
pop_obstacks ();
}
+ mark_used (dcast_fn);
result = build_call
(dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems);
*************** expand_si_desc (tdecl, type)
*** 751,760 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
--- 750,759 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
*************** expand_class_desc (tdecl, type)
*** 932,941 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
--- 931,940 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
*************** expand_ptr_desc (tdecl, type)
*** 979,988 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
--- 978,987 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
*************** expand_attr_desc (tdecl, type)
*** 1027,1036 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
--- 1026,1035 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
*************** expand_generic_desc (tdecl, type, fnname
*** 1067,1076 ****
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
- assemble_external (fn);
pop_obstacks ();
}
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}
--- 1066,1075 ----
DECL_ARTIFICIAL (fn) = 1;
pushdecl_top_level (fn);
make_function_rtl (fn);
pop_obstacks ();
}
+ mark_used (fn);
fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
expand_expr_stmt (fn);
}