This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add simple attribute introspection


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]