https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85921

--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 25 May 2018, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85921
> 
> --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Or just get rid of the bogus variable.
>   const char *noinline = "noinline";
> 
>   if (DECL_DECLARED_INLINE_P (newdecl)
>       && DECL_UNINLINABLE (olddecl)
>       && lookup_attribute (noinline, DECL_ATTRIBUTES (olddecl)))
>     warned |= warning (OPT_Wattributes, "inline declaration of %qD follows "
>                        "declaration with attribute %qs", newdecl, noinline);
>   else if (DECL_DECLARED_INLINE_P (olddecl)
>            && DECL_UNINLINABLE (newdecl)
>            && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
>     warned |= warning (OPT_Wattributes, "declaration of %q+D with attribute "
>                        "%qs follows inline declaration", newdecl, noinline);
> 
> So it uses "noinline" in the second lookup_attribute, but noinline in the 
> first
> one.
> 
> Something like:
> --- gcc/c-warn.c.jj     2018-05-21 13:15:33.878575581 +0200
> +++ gcc/c-warn.c        2018-05-25 14:28:12.151050892 +0200
> @@ -2246,18 +2246,16 @@ diagnose_mismatched_attributes (tree old
>                        newdecl);
> 
>    /* Diagnose inline __attribute__ ((noinline)) which is silly.  */
> -  const char *noinline = "noinline";
> -
>    if (DECL_DECLARED_INLINE_P (newdecl)
>        && DECL_UNINLINABLE (olddecl)
> -      && lookup_attribute (noinline, DECL_ATTRIBUTES (olddecl)))
> +      && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
>      warned |= warning (OPT_Wattributes, "inline declaration of %qD follows "
> -                      "declaration with attribute %qs", newdecl, noinline);
> +                      "declaration with attribute %<noinline%>", newdecl);
>    else if (DECL_DECLARED_INLINE_P (olddecl)
>            && DECL_UNINLINABLE (newdecl)
>            && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
>      warned |= warning (OPT_Wattributes, "declaration of %q+D with attribute "
> -                      "%qs follows inline declaration", newdecl, noinline);
> +                      "%<noinline%> follows inline declaration", newdecl);
> 
>    return warned;
>  }
> 
> perhaps for backports don't change the wording of the translatable message and
> just use "noinline" instead of noinline.

Maybe it was changed to this to make translation easier?

Reply via email to