Commit 2aa9c6ae by Richard Guenther Committed by Richard Biener

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
parent 93c3bf47
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> 2011-01-05 Tom Tromey <tromey@redhat.com>
* c-common.h (lvalue_error): Update. * c-common.h (lvalue_error): Update.
......
...@@ -6656,7 +6656,7 @@ handle_weak_attribute (tree *node, tree name, ...@@ -6656,7 +6656,7 @@ handle_weak_attribute (tree *node, tree name,
if (TREE_CODE (*node) == FUNCTION_DECL if (TREE_CODE (*node) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (*node)) && 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; *no_add_attrs = true;
} }
else if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (*node))) else if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (*node)))
......
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> 2011-01-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/47051 PR fortran/47051
......
/* { dg-do compile } */ /* { dg-do compile } */
__inline void foo(void) __attribute__((weak)); /* { dg-error "inline.*weak" } */ __inline void foo(void) __attribute__((weak)); /* { dg-warning "inline.*weak" } */
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