class.c (build_clone): Don't call defer_fn, let mark_used do it.

* class.c (build_clone): Don't call defer_fn, let mark_used do it.
	* cp-tree.h (defer_fn): Delete.
	* decl2.c (defer_fn): Delete.
	(finish_file): Simplify deferred_fns loops; check that
	only used inline functions get into deferred_fns.
	(mark_used): Inline previous contents of defer_fn.

From-SVN: r83310
This commit is contained in:
Geoffrey Keating 2004-06-17 21:11:38 +00:00 committed by Geoffrey Keating
parent 1382f0f09d
commit 2f0c006e5f
4 changed files with 29 additions and 38 deletions

View File

@ -1,3 +1,12 @@
2004-06-17 Geoffrey Keating <geoffk@apple.com>
* class.c (build_clone): Don't call defer_fn, let mark_used do it.
* cp-tree.h (defer_fn): Delete.
* decl2.c (defer_fn): Delete.
(finish_file): Simplify deferred_fns loops; check that
only used inline functions get into deferred_fns.
(mark_used): Inline previous contents of defer_fn.
2004-06-16 Richard Henderson <rth@redhat.com>
* cp-tree.h (COMPOUND_STMT_TRY_BLOCK, COMPOUND_STMT_BODY_BLOCK): Kill.

View File

@ -3915,8 +3915,6 @@ build_clone (tree fn, tree name)
DECL_TEMPLATE_INFO (result) = copy_node (DECL_TEMPLATE_INFO (result));
DECL_TI_TEMPLATE (result) = clone;
}
else if (DECL_DEFERRED_FN (fn))
defer_fn (clone);
return clone;
}

View File

@ -3739,7 +3739,6 @@ extern tree grokfield (tree, tree, tree, tree, tree);
extern tree grokbitfield (tree, tree, tree);
extern tree groktypefield (tree, tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern void defer_fn (tree);
extern void finish_anon_union (tree);
extern tree finish_table (tree, tree, tree, int);
extern tree coerce_new_type (tree);

View File

@ -1136,21 +1136,6 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (*decl), TREE_TYPE (*decl));
}
/* Defer the compilation of the FN until the end of compilation. */
void
defer_fn (tree fn)
{
if (DECL_DEFERRED_FN (fn))
return;
DECL_DEFERRED_FN (fn) = 1;
DECL_DEFER_OUTPUT (fn) = 1;
if (!deferred_fns)
VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
VARRAY_PUSH_TREE (deferred_fns, fn);
}
/* Walks through the namespace- or function-scope anonymous union OBJECT,
building appropriate ALIAS_DECLs. Returns one of the fields for use in
the mangled name. */
@ -2753,6 +2738,9 @@ finish_file (void)
{
tree decl = VARRAY_TREE (deferred_fns, i);
if (! DECL_DECLARED_INLINE_P (decl) || ! TREE_USED (decl))
abort ();
/* Does it need synthesizing? */
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
&& TREE_USED (decl)
@ -2769,19 +2757,8 @@ finish_file (void)
reconsider = true;
}
/* If the function has no body, avoid calling
import_export_decl. On a system without weak symbols,
calling import_export_decl will make an inline template
instantiation "static", which will result in errors about
the use of undefined functions if there is no body for
the function. In fact, all the functions in this list
*should* have a body. */
if (!DECL_SAVED_TREE (decl))
{
if (! DECL_DECLARED_INLINE_P (decl) || ! TREE_USED (decl))
abort ();
continue;
}
continue;
import_export_decl (decl);
@ -2853,12 +2830,11 @@ finish_file (void)
{
tree decl = VARRAY_TREE (deferred_fns, i);
if (TREE_USED (decl) && DECL_DECLARED_INLINE_P (decl)
&& !(TREE_ASM_WRITTEN (decl) || DECL_SAVED_TREE (decl)
/* An explicit instantiation can be used to specify
that the body is in another unit. It will have
already verified there was a definition. */
|| DECL_EXPLICIT_INSTANTIATION (decl)))
if (!TREE_ASM_WRITTEN (decl) && !DECL_SAVED_TREE (decl)
/* An explicit instantiation can be used to specify
that the body is in another unit. It will have
already verified there was a definition. */
&& !DECL_EXPLICIT_INSTANTIATION (decl))
{
cp_warning_at ("inline function `%D' used but never defined", decl);
/* This symbol is effectively an "extern" declaration now.
@ -3032,8 +3008,17 @@ mark_used (tree decl)
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)
&& !TREE_ASM_WRITTEN (decl))
/* Remember it, so we can check it was defined. */
defer_fn (decl);
{
if (DECL_DEFERRED_FN (decl))
return;
DECL_DEFERRED_FN (decl) = 1;
DECL_DEFER_OUTPUT (decl) = 1;
if (!deferred_fns)
VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
VARRAY_PUSH_TREE (deferred_fns, decl);
}
assemble_external (decl);
/* Is it a synthesized method that needs to be synthesized? */