[cfe-dev] Duplicate attributes

Aaron Ballman aaron at aaronballman.com
Sun Oct 6 08:02:01 PDT 2013


This is a good idea, but very difficult to implement generically from
SemaDeclAttr.cpp; you are given a parsed attribute and a decl, but the
decl has a semantic attribute object and the two do not have a direct
mapping.

I am talking more about the case where the mere presence of the
attribute is what's being guarded against, since there is a one to one
mapping of parsed attributes to semantic attributes (in a general
sense).

~Aaron



On Sat, Oct 5, 2013 at 9:15 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Sat, Oct 5, 2013 at 4:15 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> [...]
>> argument_with_type_tag
>> pointer_with_type_tag
>
> Yes, there can be multiple such attributes on a function.  But we
> could reject the case where two attributes have the same argument
> index:
>
> void A_func(void *ptr, void *tag, void *tag2)
>   __attribute__(( pointer_with_type_tag(a,1,2) ))
>   __attribute__(( pointer_with_type_tag(a,1,3) )); // expected-error
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list