From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: C++ patch ping
Date: Wed, 1 Sep 2021 22:11:12 +0200 [thread overview]
Message-ID: <20210901201112.GN920497@tucnak> (raw)
In-Reply-To: <e2ccd366-b980-c7b0-979d-e64aaf92d306@redhat.com>
On Wed, Sep 01, 2021 at 03:25:17PM -0400, Jason Merrill wrote:
> On 8/30/21 3:11 AM, Jakub Jelinek wrote:
> > Hi!
> >
> > I'd like to ping the following patches
> >
> > libcpp: __VA_OPT__ p1042r1 placemarker changes [PR101488]
> > https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575621.html
> > together with your
> > https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577602.html
> > incremental patch (successfully tested on x86_64-linux and i686-linux).
>
> OK, thanks.
Thanks, committed both patches.
> My reply to that patch approved it with a suggestion for a tweak to
> ucn_valid_in_identifier. Quoting it here:
>
> > I might check invalid_start_flags first, and return 1 if not set, then
> > check all the other flags when not pedantic, and finally return 2 if
> > nothing matches. OK with or without this change.
Sorry for missing this, didn't scroll down enough.
I don't think something like:
if (CPP_OPTION (pfile, cxx23_identifiers))
invalid_start_flags = NXX23;
else if (CPP_OPTION (pfile, c11_identifiers))
invalid_start_flags = N11;
else if (CPP_OPTION (pfile, c99))
invalid_start_flags = N99;
else
invalid_start_flags = 0;
/* In C99, UCN digits may not begin identifiers. In C11 and C++11,
UCN combining characters may not begin identifiers. */
if ((ucnranges[mn].flags & invalid_start_flags) == 0)
return 1;
/* If not -pedantic, accept as character that may
begin an identifier a union of characters allowed
at that position in each of the character sets. */
if (!CPP_PEDANTIC (pfile)
&& ((ucnranges[mn].flags & (C99 | N99)) == C99
|| (ucnranges[mn].flags & CXX) != 0
|| (ucnranges[mn].flags & (C11 | N11)) == C11
|| (ucnranges[mn].flags & (CXX23 | NXX23)) == CXX23))
return 1;
return 2;
would work, e.g. for C++98 invalid_start_flags is 0, so it would return
always 1, while the previous patch returned 2 for non-pedantic if the char
wasn't in the CXX set but was e.g. in the C99 set that wasn't allowed
as the first char (i.e. in & (C99 | N99) == (C99 | N99) set) etc.
While all C99 | N99 characters are C11 | 0, e.g.
\u0304 (and many others) are not in C99 at all, not in CXX, and in
C11 | N11 and in CXX23 | NXX23. So they are never valid as start
characters. There are also some characters like
\u1dfa which are not in C99 at all, not in CXX, not in CXX23 and in
C11 | N11, so again not valid as start character in any of the pedantic
modes. IMHO we want to return 2 for them in non-pedantic.
And testing first
if (ucnranges[mn].flags & invalid_start_flags)
return 2;
and then doing the if !CPP_PEDANTIC stuff wouldn't work either, e.g.
\U0001d18b is in CXX23 | NXX23 and in C11 | 0, so we IMHO want to return
1 for that (allowed as start character in -pedantic -std=c++20, disallowed
as start character in -pedantic -std=c++23) but we would return 2
in -std=c++23 mode.
Jakub
next prev parent reply other threads:[~2021-09-01 20:11 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 7:11 Jakub Jelinek
2021-09-01 19:25 ` Jason Merrill
2021-09-01 20:11 ` Jakub Jelinek [this message]
2021-09-01 21:46 ` Jason Merrill
-- strict thread matches above, loose matches on Subject: below --
2024-04-03 9:48 C++ Patch ping Jakub Jelinek
2024-03-08 8:56 [PATCH] c++: Fix constexpr evaluation of parameters passed by invisible reference [PR111284] Jakub Jelinek
2024-03-25 18:27 ` C++ Patch ping Jakub Jelinek
2024-03-06 14:12 C++ patch ping Jakub Jelinek
2023-09-19 7:19 Jakub Jelinek
2022-03-02 9:46 Jakub Jelinek
2021-08-16 17:37 C++ Patch ping Jakub Jelinek
2021-07-27 16:09 Jakub Jelinek
2021-01-05 16:34 Jakub Jelinek
2021-01-05 20:53 ` Jason Merrill
2020-12-03 13:59 C++ patch ping Jakub Jelinek
2020-11-09 19:24 Jakub Jelinek
2020-10-29 14:14 Jakub Jelinek
2020-03-16 15:45 C++ Patch ping Jakub Jelinek
2019-11-18 15:32 C++ patch ping Jakub Jelinek
2018-12-04 14:47 Jakub Jelinek
2018-12-06 21:43 ` Jason Merrill
2018-07-13 13:49 Jakub Jelinek
2018-07-13 16:24 ` Nathan Sidwell
2018-07-13 16:53 ` Jakub Jelinek
2018-07-13 16:42 ` Nathan Sidwell
2018-01-31 16:05 Jakub Jelinek
2018-01-02 15:12 Jakub Jelinek
2017-12-08 13:42 Jakub Jelinek
2017-09-27 10:05 Jakub Jelinek
2017-09-22 14:36 Jakub Jelinek
2017-02-06 14:13 Jakub Jelinek
2016-12-21 11:50 Jakub Jelinek
2016-12-15 8:38 C++ Patch Ping Jakub Jelinek
2016-12-15 12:26 ` Nathan Sidwell
2016-12-15 12:38 ` Jakub Jelinek
2016-12-15 12:48 ` Nathan Sidwell
2016-09-05 15:13 C++ patch ping Jakub Jelinek
2016-01-09 7:41 Jakub Jelinek
2016-01-11 20:01 ` Nathan Sidwell
2016-01-11 21:45 ` Jason Merrill
2016-01-11 21:52 ` Jakub Jelinek
2016-01-11 22:04 ` Jason Merrill
2016-01-11 23:53 ` Jakub Jelinek
2016-01-12 5:21 ` Jason Merrill
2008-04-28 20:18 Jakub Jelinek
2008-04-28 20:43 ` Mark Mitchell
2008-04-28 20:43 ` Jakub Jelinek
2008-04-28 20:59 ` Mark Mitchell
2005-02-11 14:44 Giovanni Bajo
2005-02-18 12:21 ` Mark Mitchell
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=20210901201112.GN920497@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@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).