https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117162

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <js...@gcc.gnu.org>:

https://gcc.gnu.org/g:f3b5de944ad6d1f6a10f819b816c2ba234ecd8c0

commit r15-5895-gf3b5de944ad6d1f6a10f819b816c2ba234ecd8c0
Author: Joseph Myers <josmy...@redhat.com>
Date:   Tue Dec 3 13:01:58 2024 +0000

    preprocessor: Adjust C rules on UCNs for C23 [PR117162]

    As noted in bug 117162, C23 changed some rules on UCNs to match C++
    (this was a late change agreed in the resolution to CD2 comment
    US-032, implementing changes from N3124), which we need to implement.

    Allow UCNs below 0xa0 outside identifiers for C, with a
    pedwarn-if-pedantic before C23 (and a warning with -Wc11-c23-compat)
    except for the always-allowed cases of UCNs for $ @ `.  Also as part
    of that change, do not allow \u0024 in identifiers as equivalent to $
    for C23.

    Bootstrapped with no regressions for x86_64-pc-linux-gnu.

            PR c/117162

    libcpp/
            * include/cpplib.h (struct cpp_options): Add low_ucns.
            * init.cc (struct lang_flags, lang_defaults): Add low_ucns.
            (cpp_set_lang): Set low_ucns
            * charset.cc (_cpp_valid_ucn): For C, allow UCNs below 0xa0
            outside identifiers, with a pedwarn if pedantic before C23 or a
            warning with -Wc11-c23-compat.  Do not allow \u0024 in identifiers
            for C23.

    gcc/testsuite/
            * gcc.dg/cpp/c17-ucn-1.c, gcc.dg/cpp/c17-ucn-2.c,
            gcc.dg/cpp/c17-ucn-3.c, gcc.dg/cpp/c17-ucn-4.c,
            gcc.dg/cpp/c23-ucn-2.c, gcc.dg/cpp/c23-ucnid-2.c: New tests.
            * c-c++-common/cpp/delimited-escape-seq-3.c,
            c-c++-common/cpp/named-universal-char-escape-3.c,
            gcc.dg/cpp/c23-ucn-1.c, gcc.dg/cpp/c2y-delimited-escape-seq-3.c:
            Update expected messages
            * gcc.dg/cpp/ucs.c: Use -pedantic-errors.  Update expected
            messages.

Reply via email to