re PR c/32511 (GCC rejects inline+weak function)

2011-01-12  Richard Guenther  <rguenther@suse.de>

	PR middle-end/32511
	* c-common.c (handle_weak_attribute): Warn instead of error
	on declaring an inline function weak.

	* gcc.dg/attr-weak-1.c: Adjust.

From-SVN: r168652
This commit is contained in:
Richard Guenther 2011-01-11 10:09:15 +00:00 committed by Richard Biener
parent 93c3bf479d
commit 2aa9c6ae42
4 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-01-12 Richard Guenther <rguenther@suse.de>
PR middle-end/32511
* c-common.c (handle_weak_attribute): Warn instead of error
on declaring an inline function weak.
2011-01-05 Tom Tromey <tromey@redhat.com>
* c-common.h (lvalue_error): Update.

View File

@ -6656,7 +6656,7 @@ handle_weak_attribute (tree *node, tree name,
if (TREE_CODE (*node) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (*node))
{
error ("inline function %q+D cannot be declared weak", *node);
warning (OPT_Wattributes, "inline function %q+D declared weak", *node);
*no_add_attrs = true;
}
else if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (*node)))

View File

@ -1,3 +1,8 @@
2011-01-12 Richard Guenther <rguenther@suse.de>
PR middle-end/32511
* gcc.dg/attr-weak-1.c: Adjust.
2011-01-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/47051

View File

@ -1,4 +1,4 @@
/* { dg-do compile } */
__inline void foo(void) __attribute__((weak)); /* { dg-error "inline.*weak" } */
__inline void foo(void) __attribute__((weak)); /* { dg-warning "inline.*weak" } */