This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR c/18079 (noinline and always_inline are incompatible)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 8 Feb 2009 12:15:28 +0100
- Subject: PR c/18079 (noinline and always_inline are incompatible)
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;