PR c/18079 (noinline and always_inline are incompatible)
Jan Hubicka
hubicka@ucw.cz
Sun Feb 8 14:25:00 GMT 2009
Hi,
I've run across this older bug that is trivial to fix.
Bootstrapped/regtested i686-linux, OK?
__attribute__ ((always_inline))
__attribute__ ((noinline))
void t()
{
}
__attribute__ ((noinline))
__attribute__ ((always_inline))
void q()
{
}
PR c/18079
* c-common.c (handle_noinline_attribute,
handle_always_inline_attribute): Noinline and always_inline are
incompatible.
Index: c-common.c
===================================================================
--- c-common.c (revision 143984)
+++ c-common.c (working copy)
@@ -5261,7 +5261,11 @@ handle_noinline_attribute (tree *node, t
int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (TREE_CODE (*node) == FUNCTION_DECL)
- DECL_UNINLINABLE (*node) = 1;
+ {
+ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node)))
+ error ("%qD is declared both noinline and always_inline", *node);
+ DECL_UNINLINABLE (*node) = 1;
+ }
else
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
@@ -5282,6 +5286,8 @@ handle_always_inline_attribute (tree *no
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
+ if (lookup_attribute ("noinline", DECL_ATTRIBUTES (*node)))
+ error ("%qD is declared both noinline and always_inline", *node);
/* Set the attribute and mark it for disregarding inline
limits. */
DECL_DISREGARD_INLINE_LIMITS (*node) = 1;
More information about the Gcc-patches
mailing list