public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Reject UDLs in certain contexts [PR105300]
Date: Thu, 17 Nov 2022 19:06:34 -0500	[thread overview]
Message-ID: <af0a698d-9217-fa26-043f-48991f1c8222@redhat.com> (raw)
In-Reply-To: <Y3WKcc4sJoAvsyWV@redhat.com>

On 11/16/22 20:12, Marek Polacek wrote:
> On Wed, Nov 16, 2022 at 08:22:39AM -0500, Jason Merrill wrote:
>> On 11/15/22 19:35, Marek Polacek wrote:
>>> On Tue, Nov 15, 2022 at 06:58:39PM -0500, Jason Merrill wrote:
>>>> On 11/12/22 06:53, Marek Polacek wrote:
>>>>> In this PR, we are crashing because we've encountered a UDL where a
>>>>> string-literal is expected.  This patch makes the parser reject string
>>>>> and character UDLs in all places where the grammar requires a
>>>>> string-literal and not a user-defined-string-literal.
>>>>>
>>>>> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
>>>>
>>>> Since the grammar has
>>>>
>>>> user-defined-string-literal :
>>>> 	string-literal ud-suffix
>>>>
>>>> maybe we want to move the UDL handling out to a cp_parser_udl_string_literal
>>>> that calls cp_parser_string_literal?
>>>
>>> Umm, maybe, but the UDL handling code seems to be too entrenched in
>>> cp_parser_string_literal and I don't think it's going to be easy to extract
>>> it :/.
>>
>> Fair enough; maybe a wrapper, then?
> 
> As in, have a cp_parser_udl_string_literal wrapper that calls
> cp_parser_string_literal with udl_ok=true, rename cp_parser_string_literal,
> introduce a new cp_parser_string_literal wrapper that passes udl_ok=false?

That's what I was thinking.  And the new cp_parser_string_literal could 
also omit the lookup_udlit parm.

> One problem with cp_parser_udl_string_literal is that it's too similar to
> cp_parser_userdef_string_literal, which would be confusing, I think.

True, probably better to use that name instead, and rename the current 
one to something like finish_userdef_string_literal

Jason


  reply	other threads:[~2022-11-18  0:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 16:53 Marek Polacek
2022-11-15 23:58 ` Jason Merrill
2022-11-16  0:35   ` Marek Polacek
2022-11-16 13:22     ` Jason Merrill
2022-11-17  1:12       ` Marek Polacek
2022-11-18  0:06         ` Jason Merrill [this message]
2022-11-18 23:52           ` [PATCH v2] " Marek Polacek
2022-11-19  1:39             ` Jason Merrill
2022-12-02 23:58               ` [PATCH v3] " Marek Polacek
2022-12-03 19:58                 ` Jason Merrill
2023-01-13 23:22                   ` [PATCH v4] " Marek Polacek
2023-01-24 22:49                     ` Marek Polacek
2023-01-25 19:36                     ` 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=af0a698d-9217-fa26-043f-48991f1c8222@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@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).