[v4,0/2] Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++

Message ID 20220802183602.1575950-1-tom@honermann.net
Headers
Series Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++ |

Message

Tom Honermann Aug. 2, 2022, 6:36 p.m. UTC
  This patch series provides an implementation and tests for the WG14 N2653
paper as adopted for C2X.

Additionally, a fix is included for the C++ preprocessor to treat UTF-8
character literals in preprocessor directives as an unsigned type in char8_t
enabled modes (in C++17 and earlier with -fchar8_t or in C++20 or later
without -fno-char8_t).

Tom Honermann (2):
  C: Implement C2X N2653 char8_t and UTF-8 string literal changes
  preprocessor/106426: Treat u8 character literals as unsigned in
    char8_t modes.

 gcc/c-family/c-lex.cc                         | 13 ++++--
 gcc/c-family/c-opts.cc                        |  5 ++-
 gcc/c/c-parser.cc                             | 16 ++++++-
 gcc/c/c-typeck.cc                             |  2 +-
 gcc/ginclude/stdatomic.h                      |  6 +++
 .../g++.dg/ext/char8_t-char-literal-1.C       |  6 ++-
 .../g++.dg/ext/char8_t-char-literal-2.C       |  4 ++
 .../atomic/c2x-stdatomic-lockfree-char8_t.c   | 42 +++++++++++++++++++
 .../atomic/gnu2x-stdatomic-lockfree-char8_t.c |  5 +++
 gcc/testsuite/gcc.dg/c11-utf8str-type.c       |  6 +++
 gcc/testsuite/gcc.dg/c17-utf8str-type.c       |  6 +++
 gcc/testsuite/gcc.dg/c2x-utf8str-type.c       |  6 +++
 gcc/testsuite/gcc.dg/c2x-utf8str.c            | 34 +++++++++++++++
 gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c     |  5 +++
 gcc/testsuite/gcc.dg/gnu2x-utf8str.c          | 34 +++++++++++++++
 libcpp/charset.cc                             |  4 +-
 libcpp/include/cpplib.h                       |  4 +-
 libcpp/init.cc                                |  1 +
 18 files changed, 185 insertions(+), 14 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c
 create mode 100644 gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c
 create mode 100644 gcc/testsuite/gcc.dg/c11-utf8str-type.c
 create mode 100644 gcc/testsuite/gcc.dg/c17-utf8str-type.c
 create mode 100644 gcc/testsuite/gcc.dg/c2x-utf8str-type.c
 create mode 100644 gcc/testsuite/gcc.dg/c2x-utf8str.c
 create mode 100644 gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c
 create mode 100644 gcc/testsuite/gcc.dg/gnu2x-utf8str.c