Commit 6b4e94bc by Richard Guenther Committed by Richard Biener

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
parent 62bc00e2
2008-03-27 Richard Guenther <rguenther@suse.de> 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 PR tree-optimization/32810
* tree-ssa-ccp.c (get_symbol_constant_value): Strip useless * tree-ssa-ccp.c (get_symbol_constant_value): Strip useless
conversions from DECL_INITIAL. conversions from DECL_INITIAL.
......
...@@ -5518,11 +5518,16 @@ handle_weak_attribute (tree *node, tree name, ...@@ -5518,11 +5518,16 @@ handle_weak_attribute (tree *node, tree name,
bool * ARG_UNUSED (no_add_attrs)) bool * ARG_UNUSED (no_add_attrs))
{ {
if (TREE_CODE (*node) == FUNCTION_DECL 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); declare_weak (*node);
else else
warning (OPT_Wattributes, "%qE attribute ignored", name); warning (OPT_Wattributes, "%qE attribute ignored", name);
return NULL_TREE; return NULL_TREE;
} }
......
2008-03-27 Richard Guenther <rguenther@suse.de> 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 PR tree-optimization/32810
* gcc.dg/tree-ssa/ssa-ccp-18.c: New testcase. * gcc.dg/tree-ssa/ssa-ccp-18.c: New testcase.
/* { dg-do compile } */
__inline void foo(void) __attribute__((weak)); /* { dg-error "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