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.

libcpp, v2: Implement C++23 P1949R7 - C++ Identifier Syntax using Unicode 
Standard Annex 31 [PR100977]
https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576854.html
The incremental patch for splitting tokens at unsupported characters
withdrawn, the above is the base patch.

My reply to that patch approved it with a suggestion for a tweak to ucn_valid_in_identifier. Quoting it here:

@@ -998,6 +998,28 @@ ucn_valid_in_identifier (cpp_reader *pfi
      nst->previous = c;
    nst->prev_class = ucnranges[mn].combine;
  +  if (!CPP_PEDANTIC (pfile))
+    {
+      /* 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 ((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;
+    }
+
+  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)

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.

Jason

Reply via email to