This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] add simple attribute introspection
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 11 Oct 2018 12:04:47 +0000
- Subject: Re: [PATCH] add simple attribute introspection
- References: <55577012-4f85-bc8a-5c13-a53d5e0987f6@gmail.com>
On Thu, 11 Oct 2018, Martin Sebor wrote:
> The attached patch introduces a built-in function called
> __builtin_has_attribute that makes some of this possible.
> See the documentation and tests for details.
I see nothing in the documentation about handling of equivalent forms of
an attribute - for example, specifying __aligned__ in the attribute but
aligned in __builtin_has_attribute, or vice versa. I'd expect that to be
documented to work (both of those should return true), with associated
tests. (And likewise the semantics should allow for a format attribute
using printf in one place and __printf__ in the other, for example, or the
same constant argument represented with different expressions.)
What are the semantics of __builtin_has_attribute for attributes that
can't be tested for? (E.g. the mode attribute, which ends up resulting in
some existing type with the required mode being used, so there's nothing
to indicate the attribute was originally used to declare things.)
--
Joseph S. Myers
joseph@codesourcery.com