public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Matthias Kretz <m.kretz@gsi.de>, gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org
Subject: Re: [PATCH] Add gnu::diagnose_as attribute
Date: Tue, 22 Jun 2021 15:52:16 -0400	[thread overview]
Message-ID: <bddbbb61-26da-5655-61e0-96353727ef9a@redhat.com> (raw)
In-Reply-To: <2031764.yKVeVyVuyW@minbar>

On 6/22/21 3:30 AM, Matthias Kretz wrote:
> On Wednesday, 16 June 2021 02:48:09 CEST Jason Merrill wrote:
>>> IIUC, your main concern is that my proposed diagnose_as *can* be used to
>>> make diagnostics worse, by replacing names with strings that are not
>>> valid identifiers. Of course, whoever uses the attribute to that effect
>>> should have a good reason to do so. Is your other concern that using the
>>> attribute in a "good" way is repetitive? Would you be happier if I make
>>> the string argument to the attribute optional for type aliases?
>>
>> Yes, and namespace aliases.
> 
> I'll look into making the attribute argument optional for aliases. Would you
> accept the patch with this change?

Yes (after resolving any technical details, of course).

> Questions:
> 
> 1. If a type alias applies the attribute after a type was completed /
> implicitly instantiated (and possibly already used in diagnostics) should /
> can I still modify the type and add the attribute?

Yes, because it has no semantic effect.

For alias templates, you probably want the attribute only on the 
templated class, not on the instantiations.

> 2. About the namespace aliases: IIUC an attribute would currently be rejected
> because of the C++ grammar. Do you want to make it valid before WG21
> officially decides how to proceed? And if you have a pointer for me where I'd
> have to adjust the grammar rules, that'd help. :)

You will want to adjust cp_parser_namespace_alias_definition to handle 
attributes like cp_parser_namespace_definition.  The latter currently 
accepts attributes both before and after the name, which seems like a 
good pattern to follow so it doesn't matter which WG21 chooses. 
Probably best to pedwarn about C++11 attributes in both locations for 
now, not just after.

Jason


  reply	other threads:[~2021-06-22 19:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <14205410.xuKvIAzr1H@excalibur>
     [not found] ` <20210427094648.GL3008@redhat.com>
2021-05-04 11:13   ` Matthias Kretz
2021-05-04 13:34     ` David Malcolm
2021-05-04 14:23       ` Matthias Kretz
2021-05-04 14:32         ` Matthias Kretz
2021-05-04 19:00         ` David Malcolm
2021-05-04 19:22           ` Matthias Kretz
2021-05-14 16:05     ` Martin Sebor
2021-05-26 21:33       ` Matthias Kretz
2021-05-27 17:39     ` Jason Merrill
2021-05-27 18:54       ` Matthias Kretz
2021-05-27 21:15         ` Jason Merrill
2021-05-27 22:07           ` Matthias Kretz
2021-05-28  3:05             ` Jason Merrill
2021-05-28  7:42               ` Matthias Kretz
2021-06-01 19:12                 ` Jason Merrill
2021-06-01 21:01                   ` Matthias Kretz
2021-06-11 10:01                   ` Matthias Kretz
2021-06-15 15:51                     ` Jason Merrill
2021-06-15 20:56                       ` Matthias Kretz
2021-06-16  0:48                         ` Jason Merrill
2021-06-22  7:30                           ` Matthias Kretz
2021-06-22 19:52                             ` Jason Merrill [this message]
2021-06-22 20:01                               ` Matthias Kretz
2021-06-22 20:12                                 ` Jason Merrill
2021-07-01  9:28                                   ` Matthias Kretz
2021-07-01 15:18                                     ` Jason Merrill
2021-07-05 14:18                                       ` Matthias Kretz
2021-07-07 22:34                                         ` Jason Merrill
2021-07-07  8:23                               ` Matthias Kretz
2021-07-08  1:19                                 ` Jason Merrill

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=bddbbb61-26da-5655-61e0-96353727ef9a@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=m.kretz@gsi.de \
    /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).