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