aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lang.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-16 08:05:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-16 08:05:16 +0000
commit2ed9624005aea050a572b72021952b805b65a787 (patch)
tree4a79da552d8d92dd6c4288af8f6d52ff415db7e6 /gcc/c-lang.c
parent2e0245a6b5ef3804c41b17f5784638270d34af22 (diff)
* c-lang.c (finish_file): Don't emit static inline functions if
they weren't referenced. * gcc.c-torture/execute/20011115-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lang.c')
-rw-r--r--gcc/c-lang.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 72d2536123c..5655d8cfcdf 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -271,13 +271,38 @@ void
finish_file ()
{
unsigned int i;
+ bool reconsider;
for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++)
- /* Don't output the same function twice. We may run into such
- situations when an extern inline function is later given a
- non-extern-inline definition. */
- if (! TREE_ASM_WRITTEN (VARRAY_TREE (deferred_fns, i)))
- c_expand_deferred_function (VARRAY_TREE (deferred_fns, i));
+ {
+ tree decl = VARRAY_TREE (deferred_fns, i);
+
+ if (! TREE_ASM_WRITTEN (decl) && TREE_PUBLIC (decl))
+ {
+ c_expand_deferred_function (decl);
+ VARRAY_TREE (deferred_fns, i) = NULL;
+ }
+ }
+
+ do
+ {
+ reconsider = false;
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++)
+ {
+ tree decl = VARRAY_TREE (deferred_fns, i);
+
+ if (decl
+ && ! TREE_ASM_WRITTEN (decl)
+ && (flag_keep_inline_functions
+ || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
+ {
+ c_expand_deferred_function (decl);
+ VARRAY_TREE (deferred_fns, i) = NULL;
+ reconsider = true;
+ }
+ }
+ } while (reconsider);
+
VARRAY_FREE (deferred_fns);
#ifndef ASM_OUTPUT_CONSTRUCTOR