On 11/13/18 12:15 PM, Martin Sebor wrote:
> Enabling in Glibc the recent enhancement to detect attribute
> mismatches in alias declarations (PR 81824) revealed a use
> case where aliases are being declared for targets declared
> with the always_inline attribute. Copying the always_inline
> attribute to the declaration of the alias would then trigger
>
> error: always_inline function might not be inlinable [-Werror=attributes]
>
> due to the alias not being inlinable in some contexts where
> (presumably) the target would be. To avoid the warning for
> this use case the attached patch excludes all attributes
> that affect inlining from being copied by attribute copy.
>
> While testing this I also more thoroughly exercised attribute
> tls_target (which also came up during the Glibc deployment),
> and improved the diagnostics for the attribute to make their
> root cause easier to understand (printing "attribute ignored"
> alone isn't very informative without also explaining why).
>
> Martin
>
> PS While testing this I also opened bug 88010 where inlining
> attributes on aliases seem to be silently ignored in favor of
> those on their targets. I'm wondering what the expected (or
> preferred) behavior is.
>
> gcc-attr-copy-fix.diff
>
> gcc/c-family/ChangeLog:
>
> * c-attribs.c (handle_copy_attribute): Exclude inlining attributes.
> (handle_tls_model_attribute): Improve diagnostics.
> (has_attribute): Fix a typo.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/attr-copy-5.c: New test.
> * gcc.dg/tls/diag-6.c: Adjust expected diagnostics.
OK.
jeff