Commit c32381b1 by Jason Merrill

decl.c (duplicate_decls): Don't warn about template instances.

	* decl.c (duplicate_decls): Don't warn about template instances.

	* typeck.c (mark_addressable): Lose ancient code that unsets
	DECL_EXTERNAL.

	* pt.c (do_decl_instantiation): Lose support for instantiating
	non-templates.

	* call.c (build_new_function_call): Fix handling of null explicit
 	template args.
	(build_new_method_call): Likewise.

Mon Oct  6 23:44:34 1997  Mark Mitchell  <mmitchell@usa.net>

	* method.c (build_underscore_int): Fix typo.

From-SVN: r15851
parent 45f22fa2
Tue Oct 7 00:48:36 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (duplicate_decls): Don't warn about template instances.
* typeck.c (mark_addressable): Lose ancient code that unsets
DECL_EXTERNAL.
* pt.c (do_decl_instantiation): Lose support for instantiating
non-templates.
* call.c (build_new_function_call): Fix handling of null explicit
template args.
(build_new_method_call): Likewise.
Mon Oct 6 23:44:34 1997 Mark Mitchell <mmitchell@usa.net>
* method.c (build_underscore_int): Fix typo.
1997-10-06 Brendan Kehoe <brendan@lisa.cygnus.com> 1997-10-06 Brendan Kehoe <brendan@lisa.cygnus.com>
* tree.c (print_lang_statistics): #if 0 call to * tree.c (print_lang_statistics): #if 0 call to
...@@ -5,6 +23,8 @@ ...@@ -5,6 +23,8 @@
Mon Oct 6 09:27:29 1997 Jason Merrill <jason@yorick.cygnus.com> Mon Oct 6 09:27:29 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_file): Move dump_tree_statistics to end.
* pt.c (instantiate_decl): Look for the original template. * pt.c (instantiate_decl): Look for the original template.
(tsubst): Set DECL_IMPLICIT_INSTANTIATION on partial instantiations (tsubst): Set DECL_IMPLICIT_INSTANTIATION on partial instantiations
of member templates. of member templates.
......
...@@ -4484,11 +4484,13 @@ build_new_function_call (fn, args, obj) ...@@ -4484,11 +4484,13 @@ build_new_function_call (fn, args, obj)
{ {
struct z_candidate *candidates = 0, *cand; struct z_candidate *candidates = 0, *cand;
tree explicit_targs = NULL_TREE; tree explicit_targs = NULL_TREE;
int template_only = 0;
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
{ {
explicit_targs = TREE_OPERAND (fn, 1); explicit_targs = TREE_OPERAND (fn, 1);
fn = TREE_OPERAND (fn, 0); fn = TREE_OPERAND (fn, 0);
template_only = 1;
} }
if (obj == NULL_TREE && really_overloaded_fn (fn)) if (obj == NULL_TREE && really_overloaded_fn (fn))
...@@ -4510,7 +4512,7 @@ build_new_function_call (fn, args, obj) ...@@ -4510,7 +4512,7 @@ build_new_function_call (fn, args, obj)
(candidates, t, explicit_targs, args, NULL_TREE, (candidates, t, explicit_targs, args, NULL_TREE,
LOOKUP_NORMAL); LOOKUP_NORMAL);
} }
else if (explicit_targs == NULL_TREE) else if (! template_only)
candidates = add_function_candidate candidates = add_function_candidate
(candidates, t, args, LOOKUP_NORMAL); (candidates, t, args, LOOKUP_NORMAL);
} }
...@@ -5466,11 +5468,13 @@ build_new_method_call (instance, name, args, basetype_path, flags) ...@@ -5466,11 +5468,13 @@ build_new_method_call (instance, name, args, basetype_path, flags)
tree pretty_name; tree pretty_name;
tree user_args = args; tree user_args = args;
tree templates = NULL_TREE; tree templates = NULL_TREE;
int template_only = 0;
if (TREE_CODE (name) == TEMPLATE_ID_EXPR) if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
{ {
explicit_targs = TREE_OPERAND (name, 1); explicit_targs = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0); name = TREE_OPERAND (name, 0);
template_only = 1;
} }
/* If there is an extra argument for controlling virtual bases, /* If there is an extra argument for controlling virtual bases,
...@@ -5574,7 +5578,7 @@ build_new_method_call (instance, name, args, basetype_path, flags) ...@@ -5574,7 +5578,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
TREE_TYPE (name), TREE_TYPE (name),
LOOKUP_NORMAL); LOOKUP_NORMAL);
} }
else if (explicit_targs == NULL_TREE) else if (! template_only)
candidates = add_function_candidate (candidates, t, candidates = add_function_candidate (candidates, t,
this_arglist, flags); this_arglist, flags);
......
...@@ -2623,8 +2623,9 @@ duplicate_decls (newdecl, olddecl) ...@@ -2623,8 +2623,9 @@ duplicate_decls (newdecl, olddecl)
} }
} }
if (TREE_CODE (olddecl) == FUNCTION_DECL if (DECL_USE_TEMPLATE (olddecl))
&& ! DECL_USE_TEMPLATE (olddecl)) ;
else if (TREE_CODE (olddecl) == FUNCTION_DECL)
{ {
tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl)); tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl));
tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl)); tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl));
......
...@@ -424,7 +424,7 @@ build_underscore_int (int i) ...@@ -424,7 +424,7 @@ build_underscore_int (int i)
OB_PUTC ('_'); OB_PUTC ('_');
icat (i); icat (i);
if (i > 9) if (i > 9)
OB_PUTS ('_'); OB_PUTC ('_');
} }
/* Encoding for an INTEGER_CST value. */ /* Encoding for an INTEGER_CST value. */
......
...@@ -4226,24 +4226,14 @@ do_decl_instantiation (declspecs, declarator, storage) ...@@ -4226,24 +4226,14 @@ do_decl_instantiation (declspecs, declarator, storage)
fn = TREE_VALUE (fn); fn = TREE_VALUE (fn);
for (; fn; fn = DECL_CHAIN (fn)) for (; fn; fn = DECL_CHAIN (fn))
if (decls_match (fn, decl) && DECL_DEFER_OUTPUT (fn)) if (TREE_CODE (fn) == TEMPLATE_DECL)
{
result = fn;
break;
}
else if (TREE_CODE (fn) == TEMPLATE_DECL)
templates = decl_tree_cons (NULL_TREE, fn, templates); templates = decl_tree_cons (NULL_TREE, fn, templates);
} }
} }
else if (name = DECL_NAME (decl), fn = IDENTIFIER_GLOBAL_VALUE (name), fn) else if (name = DECL_NAME (decl), fn = IDENTIFIER_GLOBAL_VALUE (name), fn)
{ {
for (fn = get_first_fn (fn); fn; fn = DECL_CHAIN (fn)) for (fn = get_first_fn (fn); fn; fn = DECL_CHAIN (fn))
if (decls_match (fn, decl) && DECL_DEFER_OUTPUT (fn)) if (TREE_CODE (fn) == TEMPLATE_DECL)
{
result = fn;
break;
}
else if (TREE_CODE (fn) == TEMPLATE_DECL)
templates = decl_tree_cons (NULL_TREE, fn, templates); templates = decl_tree_cons (NULL_TREE, fn, templates);
} }
......
...@@ -4772,15 +4772,6 @@ mark_addressable (exp) ...@@ -4772,15 +4772,6 @@ mark_addressable (exp)
be non-zero in the case of processing a default function. be non-zero in the case of processing a default function.
The second may be non-zero in the case of a template function. */ The second may be non-zero in the case of a template function. */
x = DECL_MAIN_VARIANT (x); x = DECL_MAIN_VARIANT (x);
if ((DECL_THIS_INLINE (x) || DECL_PENDING_INLINE_INFO (x))
&& (DECL_CONTEXT (x) == NULL_TREE
|| TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (x))) != 't'
|| ! CLASSTYPE_INTERFACE_ONLY (DECL_CONTEXT (x))))
{
mark_inline_for_output (x);
if (x == current_function_decl)
DECL_EXTERNAL (x) = 0;
}
if (DECL_TEMPLATE_INFO (x) && !DECL_TEMPLATE_SPECIALIZATION (x)) if (DECL_TEMPLATE_INFO (x) && !DECL_TEMPLATE_SPECIALIZATION (x))
mark_used (x); mark_used (x);
TREE_ADDRESSABLE (x) = 1; TREE_ADDRESSABLE (x) = 1;
......
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