[cfe-dev] Feature request: Don't warn for specified "unknown" attribute
Justin Bassett via cfe-dev
cfe-dev at lists.llvm.org
Mon Apr 15 20:01:23 PDT 2019
The following code will emit a warning with -Wattributes:
[[some_ns::some_attribute]]
void call_me();
<source>:1:3: warning: unknown attribute 'some_attribute' ignored
[-Wunknown-attributes]
[[some_ns::some_attribute]]
^
However, this warning is very useful for detecting typos of standard
attributes. AFAIK, there's no way to turn off the warning just for one
attribute, just all of them (-Wno-unknown-attributes).
To solve this, I propose that we add the ability to specify attributes to
ignore for -Wunknown-attributes. In other words, something like this:
'-Wignore-unknown-attribute=some_ns::some_attribute'.
There are some alternatives, such as only warning if the edit distance is
close to a known attribute, but I think that specifying the known attribute
in the build system like this is better, as it will also catch
misspellings of [[some_ns::some_attribute]].
Thank you,
Justin Bassett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190415/94fd76a9/attachment.html>
More information about the cfe-dev
mailing list