-
- Downloads
C: Implement C2X N2653 char8_t and UTF-8 string literal changes
This patch implements the core language and compiler dependent library changes adopted for C2X via WG14 N2653. The changes include: - Change of type for UTF-8 string literals from array of const char to array of const char8_t (unsigned char). - A new atomic_char8_t typedef. - A new ATOMIC_CHAR8_T_LOCK_FREE macro defined in terms of the existing __GCC_ATOMIC_CHAR8_T_LOCK_FREE predefined macro. gcc/ChangeLog: * ginclude/stdatomic.h (atomic_char8_t, ATOMIC_CHAR8_T_LOCK_FREE): New typedef and macro. gcc/c/ChangeLog: * c-parser.cc (c_parser_string_literal): Use char8_t as the type of CPP_UTF8STRING when char8_t support is enabled. * c-typeck.cc (digest_init): Allow initialization of an array of character type by a string literal with type array of char8_t. gcc/c-family/ChangeLog: * c-lex.cc (lex_string, lex_charconst): Use char8_t as the type of CPP_UTF8CHAR and CPP_UTF8STRING when char8_t support is enabled. * c-opts.cc (c_common_post_options): Set flag_char8_t if targeting C2x. gcc/testsuite/ChangeLog: * gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c: New test. * gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c: New test. * gcc.dg/c11-utf8str-type.c: New test. * gcc.dg/c17-utf8str-type.c: New test. * gcc.dg/c2x-utf8str-type.c: New test. * gcc.dg/c2x-utf8str.c: New test. * gcc.dg/gnu2x-utf8str-type.c: New test. * gcc.dg/gnu2x-utf8str.c: New test.
Showing
- gcc/c-family/c-lex.cc 9 additions, 4 deletionsgcc/c-family/c-lex.cc
- gcc/c-family/c-opts.cc 2 additions, 2 deletionsgcc/c-family/c-opts.cc
- gcc/c/c-parser.cc 14 additions, 2 deletionsgcc/c/c-parser.cc
- gcc/c/c-typeck.cc 1 addition, 1 deletiongcc/c/c-typeck.cc
- gcc/ginclude/stdatomic.h 6 additions, 0 deletionsgcc/ginclude/stdatomic.h
- gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c 42 additions, 0 deletionsgcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c
- gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c 5 additions, 0 deletions...estsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c
- gcc/testsuite/gcc.dg/c11-utf8str-type.c 6 additions, 0 deletionsgcc/testsuite/gcc.dg/c11-utf8str-type.c
- gcc/testsuite/gcc.dg/c17-utf8str-type.c 6 additions, 0 deletionsgcc/testsuite/gcc.dg/c17-utf8str-type.c
- gcc/testsuite/gcc.dg/c2x-utf8str-type.c 6 additions, 0 deletionsgcc/testsuite/gcc.dg/c2x-utf8str-type.c
- gcc/testsuite/gcc.dg/c2x-utf8str.c 34 additions, 0 deletionsgcc/testsuite/gcc.dg/c2x-utf8str.c
- gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c 5 additions, 0 deletionsgcc/testsuite/gcc.dg/gnu2x-utf8str-type.c
- gcc/testsuite/gcc.dg/gnu2x-utf8str.c 34 additions, 0 deletionsgcc/testsuite/gcc.dg/gnu2x-utf8str.c
Loading
Please register or sign in to comment