c-lang.c (finish_file): Don't emit static inline functions if they weren't referenced.
* 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. From-SVN: r47082
This commit is contained in:
parent
38b3baaef4
commit
25e7f43985
@ -1,3 +1,8 @@
|
|||||||
|
2001-11-16 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* c-lang.c (finish_file): Don't emit static inline functions if
|
||||||
|
they weren't referenced.
|
||||||
|
|
||||||
2001-11-15 Stan Shebs <shebs@apple.com>
|
2001-11-15 Stan Shebs <shebs@apple.com>
|
||||||
|
|
||||||
* expr.c (expand_expr, case COMPONENT_REF): Fix variable ref.
|
* expr.c (expand_expr, case COMPONENT_REF): Fix variable ref.
|
||||||
|
35
gcc/c-lang.c
35
gcc/c-lang.c
@ -271,13 +271,38 @@ void
|
|||||||
finish_file ()
|
finish_file ()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
bool reconsider;
|
||||||
|
|
||||||
for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++)
|
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
|
tree decl = VARRAY_TREE (deferred_fns, i);
|
||||||
non-extern-inline definition. */
|
|
||||||
if (! TREE_ASM_WRITTEN (VARRAY_TREE (deferred_fns, i)))
|
if (! TREE_ASM_WRITTEN (decl) && TREE_PUBLIC (decl))
|
||||||
c_expand_deferred_function (VARRAY_TREE (deferred_fns, i));
|
{
|
||||||
|
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);
|
VARRAY_FREE (deferred_fns);
|
||||||
|
|
||||||
#ifndef ASM_OUTPUT_CONSTRUCTOR
|
#ifndef ASM_OUTPUT_CONSTRUCTOR
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-11-16 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* gcc.c-torture/execute/20011115-1.c: New test.
|
||||||
|
|
||||||
2001-11-15 Jakub Jelinek <jakub@redhat.com>
|
2001-11-15 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* gcc.c-torture/compile/20011114-2.c: New test.
|
* gcc.c-torture/compile/20011114-2.c: New test.
|
||||||
|
26
gcc/testsuite/gcc.c-torture/execute/20011115-1.c
Normal file
26
gcc/testsuite/gcc.c-torture/execute/20011115-1.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
extern void exit (int);
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
#ifdef __OPTIMIZE__
|
||||||
|
extern int undefined_reference;
|
||||||
|
return undefined_reference;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
bar (void)
|
||||||
|
{
|
||||||
|
if (foo == foo)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return foo ();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
exit (0);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user