Commit fea10e36 by Alexandre Oliva Committed by Jakub Jelinek

decl.c (duplicate_decls): Preserve linkage flags for mere redeclarations of gnu_inline definitions.

2007-10-01  Alexandre Oliva  <aoliva@redhat.com>

	* decl.c (duplicate_decls): Preserve linkage flags for mere
	redeclarations of gnu_inline definitions.

	* g++.dg/ext/gnu-inline-global-redecl.C: New.

From-SVN: r128992
parent 0064fbe9
2007-10-03 Alexandre Oliva <aoliva@redhat.com>
* decl.c (duplicate_decls): Preserve linkage flags for mere
redeclarations of gnu_inline definitions.
2007-10-03 Jason Merrill <jason@redhat.com> 2007-10-03 Jason Merrill <jason@redhat.com>
PR c++/15764 PR c++/15764
......
...@@ -1846,24 +1846,24 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1846,24 +1846,24 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
new_template = NULL_TREE; new_template = NULL_TREE;
if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl)) if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl))
{ {
bool old_decl_gnu_inline; bool new_redefines_gnu_inline = false;
if ((DECL_INTERFACE_KNOWN (olddecl) if (new_defines_function
&& TREE_CODE (olddecl) == FUNCTION_DECL) && ((DECL_INTERFACE_KNOWN (olddecl)
|| (TREE_CODE (olddecl) == TEMPLATE_DECL && TREE_CODE (olddecl) == FUNCTION_DECL)
&& TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL)) || (TREE_CODE (olddecl) == TEMPLATE_DECL
&& (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl))
== FUNCTION_DECL))))
{ {
tree fn = olddecl; tree fn = olddecl;
if (TREE_CODE (fn) == TEMPLATE_DECL) if (TREE_CODE (fn) == TEMPLATE_DECL)
fn = DECL_TEMPLATE_RESULT (olddecl); fn = DECL_TEMPLATE_RESULT (olddecl);
old_decl_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn); new_redefines_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn);
} }
else
old_decl_gnu_inline = false;
if (!old_decl_gnu_inline) if (!new_redefines_gnu_inline)
{ {
DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl); DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl); DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
......
2007-10-03 Alexandre Oliva <aoliva@redhat.com>
* g++.dg/ext/gnu-inline-global-redecl.C: New.
2007-10-03 Richard Sandiford <rsandifo@nildram.co.uk> 2007-10-03 Richard Sandiford <rsandifo@nildram.co.uk>
PR target/33635 PR target/33635
/* Test __attribute__((gnu_inline)).
Check that we don't get out-of-line definitions for extern inline
gnu_inline functions, regardless of redeclaration.
*/
/* { dg-do link } */
/* { dg-options "-O" } */ // such that static functions are optimized out
#include "gnu-inline-common.h"
decl(extern, fn)
gnuindef(fn, 0)
decl(extern, fn)
int main () {
fn ();
}
...@@ -443,7 +443,7 @@ finished_with_expr (temp_expr_table_p tab, int version, bool free_expr) ...@@ -443,7 +443,7 @@ finished_with_expr (temp_expr_table_p tab, int version, bool free_expr)
} }
/* Create an expression entry fora replaceable expression. */ /* Create an expression entry for a replaceable expression. */
static void static void
process_replaceable (temp_expr_table_p tab, tree stmt) process_replaceable (temp_expr_table_p tab, tree stmt)
......
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