public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] attribs: Implement -Wno-attributes=vendor::attr [PR101940]
Date: Mon, 20 Sep 2021 14:37:03 -0400	[thread overview]
Message-ID: <YUjUz0Xi9AEDEaG6@redhat.com> (raw)
In-Reply-To: <20210920173859.GK304296@tucnak>

On Mon, Sep 20, 2021 at 07:38:59PM +0200, Jakub Jelinek wrote:
> On Mon, Sep 20, 2021 at 01:06:58PM -0400, Marek Polacek via Gcc-patches wrote:
> 
> Not a review, just a few nits:
> 
> I think it would be useful to clarify that -Wno-attributes=list doesn't
> actually imply -Wno-attributes

Agreed, fixed with:

+Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
 
> > --- a/gcc/common.opt
> > +++ b/gcc/common.opt
> > @@ -88,6 +88,9 @@ void *flag_instrument_functions_exclude_functions
> >  Variable
> >  void *flag_instrument_functions_exclude_files
> >  
> > +Variable
> > +void *flag_ignored_attributes
> > +
> >  ; Generic structs (e.g. templates not explicitly specialized)
> >  ; may not have a compilation unit associated with them, and so
> >  ; may need to be treated differently from ordinary structs.
> > @@ -546,6 +549,10 @@ Wattributes
> >  Common Var(warn_attributes) Init(1) Warning
> >  Warn about inappropriate attribute usage.
> >  
> > +Wattributes=
> > +Common Joined
> > +Do not warn about specified attributes.
> > +
> 
> So, wouldn't be this better specified as
> Wno-attributes=
> Common Joined RejectNegative
> (not sure if RejectNegative is actually needed for an option
> starting with Wno- )?

Looks like RejectNegative is not needed.  I could do that, but I think
it regresses the diagnostic:

error: unrecognized command-line option '-Wattributes=attr::'
vs
error: arguments ignored for ‘-Wattributes=’; use ‘-Wno-attributes=’ instead

I prefer the latter.  (I've changed the warning into error.)
 
> > +/* { dg-additional-options "-std=c++11" { target c++ } } */
> > +/* { dg-additional-options "-Wno-attributes=company::,yoyodyne::attr" } */
> > +/* { dg-additional-options "-Wno-attributes=c1::attr,c1::attr,c1::__attr__" } */
> > +/* { dg-additional-options "-Wno-attributes=clang" } */
> > +/* { dg-additional-options "-Wno-attributes=c2::,c2::attr" } */
> > +/* { dg-additional-options "-Wno-attributes=c3::attr,c3::" } */
> > +/* { dg-additional-options "-Wno-attributes=x::," } */
> 
> Should the above be accepted (I mean trailing , ?)  What does that mean?
 
I'm thinking it should: the arguments to -Wno-attributes= could be
generated by a tool so accepting the trailing , might help, like in
enums etc.

> > +/* { dg-additional-options "-Wno-attributes=yoyodyne::attr_new" } */
> > +/* { dg-additional-options "-Wno-attributes=c4::__attr__" } */
> 
> When writing __attr__, does that imply we won't warn about both
> c4::attr and c4::__attr__ (and __c4__::attr and __c4__::__attr__) like
> it would when writing -Wno-attributes=c4::attr ?

"__attr__" and "attr" ought to be interchangeable.  __c4__:: and c4:: currently
are not, but I guess they should.  I'll post a v2 with that fixed.

Thanks!
--
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA


  reply	other threads:[~2021-09-20 18:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 17:06 Marek Polacek
2021-09-20 17:38 ` Jakub Jelinek
2021-09-20 18:37   ` Marek Polacek [this message]
2021-09-20 19:03     ` [PATCH v2] " Marek Polacek
2021-09-20 19:08     ` [PATCH] " Jakub Jelinek
2021-09-20 22:59       ` [PATCH v3] " Marek Polacek
2021-09-23 18:25         ` Jason Merrill
2021-09-28 20:20           ` [PATCH v4] " Marek Polacek
2021-10-11 15:17             ` Marek Polacek
2021-10-29 16:47               ` Marek Polacek
2021-11-05 18:48             ` Jason Merrill
2021-11-06  0:21               ` [PATCH v5] " Marek Polacek
2021-11-06  1:32                 ` Bernhard Reutner-Fischer
2021-11-06 18:28                   ` Marek Polacek
2021-11-06 19:29                     ` Jason Merrill
2021-11-06 20:29                       ` Bernhard Reutner-Fischer
2021-11-09  1:41                       ` [PATCH v6] " Marek Polacek
2021-11-09  5:12                         ` Jason Merrill
2021-11-09  7:09                           ` Bernhard Reutner-Fischer
2021-11-09 15:55                             ` Marek Polacek
2021-11-09 17:27                               ` Jason Merrill
2021-11-09 19:17                                 ` [PATCH v7] " Marek Polacek
2021-11-09 19:47                                   ` Bernhard Reutner-Fischer
2021-11-09 19:57                                     ` Bernhard Reutner-Fischer
2021-11-09 20:23                                       ` Marek Polacek
2021-11-09 21:30                                   ` [PATCH v8] " Marek Polacek
2021-11-10  5:53                                     ` Jason Merrill
2021-11-09 15:51                           ` [PATCH v6] " Marek Polacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUjUz0Xi9AEDEaG6@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).