public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Feature request: Don't warn for specified "unknown" attribute
@ 2019-04-16  3:05 Justin Bassett
  2019-04-16 11:24 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Justin Bassett @ 2019-04-16  3:05 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Feature request: Don't warn for specified "unknown" attribute
  2019-04-16  3:05 Feature request: Don't warn for specified "unknown" attribute Justin Bassett
@ 2019-04-16 11:24 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2019-04-16 11:24 UTC (permalink / raw)
  To: Justin Bassett; +Cc: gcc

On Tue, 16 Apr 2019 at 04:06, Justin Bassett wrote:
>
> 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]].

An option like that has been discussed before. I thought it was in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86368 but I don't see it
there, so feel free to add a comment about it there.

I still like my suggestion at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86368#c2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-16 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16  3:05 Feature request: Don't warn for specified "unknown" attribute Justin Bassett
2019-04-16 11:24 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).