[cfe-dev] Duplicate attributes
Richard Smith
richard at metafoo.co.uk
Sun Oct 6 18:01:10 PDT 2013
On 5 Oct 2013 16:15, "Aaron Ballman" <aaron at aaronballman.com> wrote:
>
> I noticed that we have a diagnostic "err_repeat_attribute", but
> currently only vecreturn is making use of it.
>
> This seems like it is something we could generalize across attributes
> relatively easily, but there appears to be no documentation (even in
> the C++ standard) as to whether duplicate attributes are acceptable or
> not for any given attribute.
For a standard c++11 attribute, there is usually (always?) a restriction
that the attribute cannot be repeated in the same attribute-specifier.
> As best I can tell, most attributes should diagnose a duplicate on the
> same subject. The exceptions, as best I can gather, are:
>
> alloc_size
> format_arg
> nonnull
> ownership_holds
> ownership_returns
> ownership_takes
> argument_with_type_tag
> pointer_with_type_tag
>
> Basically, anything which allows you to specify an argument index as
> an attribute parameter seems like it could have a duplicate attribute.
>
> Would it make sense to add a generalized duplicate attribute test in
> SemaDeclAttr that emits an error when a duplicate is found, except for
> the above cases?
>
> ~Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131006/8489d7f3/attachment.html>
More information about the cfe-dev
mailing list