[cfe-dev] Feature request: Don't warn for specified "unknown" attribute

Justin Bassett via cfe-dev cfe-dev at lists.llvm.org
Wed Apr 17 09:44:59 PDT 2019

> We support around 300 attributes currently, and this is a
> fraction of the total attributes supported by all vendors and our list
> of supported attributes (as well as other compiler's similar lists)
> change with every release. I haven't seen any evidence that a list of
> specific attributes to not diagnose is useful in the face of the sheer
> number of possible attributes.

I severely underestimated the amount of attributes which may need to be
listed through whitelisting. The 300 clang-supported attributes wouldn't
need to be whitelisted since they are already known, but it's certainly
conceivable that some unknown third party attributes could reach 30s to
100s or above, which is no longer that reasonable to list individually.

I would be comfortable having two separate "unknown attribute" warning
> flags: -Wunknown-attributes and -Wunknown-attribute-namespaces (or
> something) where the distinction is the former warns on any unknown
> attribute regardless of namespace, and the latter only diagnoses
> unknown attributes in namespaces for which Clang does not support any
> attributes. This seems like it would have a useful level of
> granularity while not requiring the user to maintain a separate list
> of things in the build system. It also nicely sidesteps problems like
> attributes with multiple spellings or target-specific attributes.

I agree with this option. I already thought was reasonable, but now that I
realize how many attributes there are, it seems to be one of the better


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190417/4bbf7ec0/attachment.html>

More information about the cfe-dev mailing list