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

2008-03-27  Richard Guenther  <rguenther@suse.de>

	PR c/32511
	* c-common.c (handle_weak_attribute): Reject combination of
	weak and inline.

	* gcc.dg/attr-weak-1.c: New testcase.

From-SVN: r133646
This commit is contained in:
Richard Guenther 2008-03-27 16:34:55 +00:00 committed by Richard Biener
parent 62bc00e258
commit 6b4e94bcae
4 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2008-03-27 Richard Guenther <rguenther@suse.de>
PR c/32511
* c-common.c (handle_weak_attribute): Reject combination of
weak and inline.
2008-03-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/32810

View File

@ -5518,11 +5518,16 @@ handle_weak_attribute (tree *node, tree name,
bool * ARG_UNUSED (no_add_attrs))
{
if (TREE_CODE (*node) == FUNCTION_DECL
|| TREE_CODE (*node) == VAR_DECL)
&& DECL_DECLARED_INLINE_P (*node))
{
error ("inline function %q+D cannot be declared weak", *node);
*no_add_attrs = true;
}
else if (TREE_CODE (*node) == FUNCTION_DECL
|| TREE_CODE (*node) == VAR_DECL)
declare_weak (*node);
else
warning (OPT_Wattributes, "%qE attribute ignored", name);
return NULL_TREE;
}

View File

@ -1,3 +1,8 @@
2008-03-27 Richard Guenther <rguenther@suse.de>
PR c/32511
* gcc.dg/attr-weak-1.c: New testcase.
2008-03-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/32810

View File

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