c-decl.c (merge_decls): Use !current_function_decl to check for extern declaration of C99 inline...

* c-decl.c (merge_decls): Use !current_function_decl to check for
	extern declaration of C99 inline function being at file scope.

testsuite:
	* gcc.dg/inline-32.c, gcc.dg/inline-32a.c: New tests.

From-SVN: r137149
This commit is contained in:
Joseph Myers 2008-06-26 16:40:56 +01:00 committed by Joseph Myers
parent 30551d999a
commit 74b0ec7c40
5 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-06-26 Joseph Myers <joseph@codesourcery.com>
* c-decl.c (merge_decls): Use !current_function_decl to check for
extern declaration of C99 inline function being at file scope.
2008-06-25 John David Anglin <dave.anglin@gcc-cnrc.gc.ca>
* config.gcc (hppa[12]*-*-hpux10*): Don't use fixproto.

View File

@ -1764,8 +1764,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|| !DECL_EXTERNAL (olddecl))
&& DECL_EXTERNAL (newdecl)
&& !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))
&& (DECL_CONTEXT (newdecl) == NULL_TREE
|| TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL))
&& !current_function_decl)
DECL_EXTERNAL (newdecl) = 0;
if (DECL_EXTERNAL (newdecl))

View File

@ -1,3 +1,7 @@
2008-06-26 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/inline-32.c, gcc.dg/inline-32a.c: New tests.
2008-06-26 Ira Rosen <irar@il.ibm.com>
* testsuite/lib/target-supports.exp

View File

@ -0,0 +1,11 @@
/* { dg-do link } */
/* { dg-options "-std=c99 -pedantic-errors" } */
/* { dg-additional-sources inline-32a.c } */
inline int f (void) { return 0; }
int
main (void)
{
extern int f();
return f ();
}

View File

@ -0,0 +1,3 @@
/* { dg-do compile } */
/* { dg-options "-std=c99 -pedantic-errors" } */
int f (void) { return 0; }