This is the mail archive of the gcc@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]

Feature request: Don't warn for specified "unknown" attribute


The following code will emit a warning with -Wattributes:

[[some_ns::some_attribute]]
void call_me();

<source>:2:14: warning: 'some_ns::some_attribute' scoped attribute
directive ignored [-Wattributes]
    2 | void call_me();
      |              ^

I want to disable the warning for third party attributes, but this warning
is very useful for detecting typos of standard attributes, so I want to
keep it for all other attributes. AFAIK, there's no way to turn off the
warning just for one attribute, just all of them (-Wno-attributes).

To solve this, I propose that we add the ability to specify attributes to
ignore if they are unknown. 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


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