From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
Marek Polacek <polacek@redhat.com>,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libcpp, v2: Implement C++23 P1949R7 - C++ Identifier Syntax using Unicode Standard Annex 31
Date: Mon, 16 Aug 2021 19:45:55 -0400 [thread overview]
Message-ID: <285d855b-bb6a-d9cc-5748-38c679a63882@redhat.com> (raw)
In-Reply-To: <20210816205149.GD2380545@tucnak>
On 8/16/21 4:51 PM, Jakub Jelinek wrote:
> On Mon, Aug 16, 2021 at 04:21:00PM -0400, Jason Merrill wrote:
>>> I see for the UTF-8 chars we have:
>>> switch (ucn_valid_in_identifier (pfile, *cp, nst))
>>> {
>>> case 0:
>>> /* In C++, this is an error for invalid character in an identifier
>>> because logically, the UTF-8 was converted to a UCN during
>>> translation phase 1 (even though we don't physically do it that
>>> way). In C, this byte rather becomes grammatically a separate
>>> token. */
>>> if (CPP_OPTION (pfile, cplusplus))
>>> cpp_error (pfile, CPP_DL_ERROR,
>>> "extended character %.*s is not valid in an identifier",
>>> (int) (*pstr - base), base);
>>> else
>>> {
>>> *pstr = base;
>>> return false;
>>> }
>>> So, shall we behave the same as C for cxx23_identifiers here? And shall we
>>> do something similar for the UCNs in \uxxxx and \Uxxxxxxxx forms?
>>> Confused...
>>
>> I tend to agree with Joseph's comment on your followup patch about this
>> issue; do you?
>
> It isn't clear to me if it is ok that it is an error even with just -E,
> i.e. whether
> "If a single universal-character-name does not match any of the other
> preprocessing token categories, the program is ill-formed."
> applies already in translation phase 4 which is what -E emits (or some other
> one?), or only in phase 7 when converting preprocessing tokens to tokens.
I read it as applying in phase 3.
> But sure, if you agree with Joseph that the followup isn't needed, the
> diagnostics is much better that way and I'd certainly prefer just this
> patch and not the follow-up.
>
> If not -E, I guess the standard is clear that it is invalid and how exactly
> we diagnose it is QoI.
>
> Jakub
>
next prev parent reply other threads:[~2021-08-16 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 8:09 [PATCH] libcpp: " Jakub Jelinek
2021-08-06 9:53 ` [PATCH] libcpp, v2: " Jakub Jelinek
2021-08-06 14:47 ` [PATCH] libcpp: For C++23 treat UCNs and UTF-8 chars not valid in identifiers as separate tokens Jakub Jelinek
2021-08-06 20:08 ` Joseph Myers
2021-08-16 20:21 ` [PATCH] libcpp, v2: Implement C++23 P1949R7 - C++ Identifier Syntax using Unicode Standard Annex 31 Jason Merrill
2021-08-16 20:51 ` Jakub Jelinek
2021-08-16 23:45 ` Jason Merrill [this message]
2021-08-17 7:48 ` Jakub Jelinek
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=285d855b-bb6a-d9cc-5748-38c679a63882@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--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).