This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: Usage of __attribute__used__ in (system) headers?
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, libc-alpha at sourceware dot org, libc-ports at sourceware dot org
- Date: Mon, 18 Feb 2013 14:41:02 -0500
- Subject: Re: Usage of __attribute__used__ in (system) headers?
- References: <87r4khnbqm.fsf@kepler.schwinge.homeip.net> <CAE2sS1hXkxSq_sr=ySEeaV99O5WOAmaygufmeGmwMuc2d+EnZw@mail.gmail.com> <51227F2E.5060103@twiddle.net>
On Mon, Feb 18, 2013 at 2:21 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 02/18/2013 11:00 AM, Carlos O'Donell wrote:
>>> > static union { unsigned char __c[4]; float __d; } __nan_union
>>> > - __attribute_used__ = { __nan_bytes };
>>> > + = { __nan_bytes };
>>> > # define NAN (__nan_union.__d)
>>> >
>>> > #endif /* GCC. */
>> I disagree, it's useful to mark the non-GCC version with
>> an __attribute_used__ such that in the future we might
>> use another compiler without problems.
>
> The annotation should not be attribute used at all, but rather unused.
>
> Used says that the object is referenced in some non-visible way by
> assembly, and thus cannot be elided. Unused says that we understand the
> variable may not be referenced, and don't warn; but do, in particular,
> remove it if it is unused.
Yes, thanks for catching that, honestly I forget that it's a "possibly
unused" in that case.
glibc doesn't have an __attribute_unused__.
I'd be happy to review a patch that adds it and fixes up the 8
references to the bare attribute.
Cheers,
Carlos.