From: Geoffrey Keating Date: Thu, 17 Jun 2004 21:11:38 +0000 (+0000) Subject: class.c (build_clone): Don't call defer_fn, let mark_used do it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f0c006e5f47dc1ccfe2f89c62711b4f304218aa;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08ac68f0f09..1c1f0d660cd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-06-17 Geoffrey Keating + + * 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 * cp-tree.h (COMPOUND_STMT_TRY_BLOCK, COMPOUND_STMT_BODY_BLOCK): Kill. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 055c68deabf..1853d4faadf 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 36d493c26fd..cb2a1431a93 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8157950371b..eacab5f283b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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? */