aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorTom Honermann <tom@honermann.net>2019-01-14 19:55:51 +0000
committerJason Merrill <jason@gcc.gnu.org>2019-01-14 14:55:51 -0500
commit2d91f79dc990f81dcea89a5087cad566238b2456 (patch)
treeae9137b811a3a0bdada65dbb8a6ed5dba9d24b0e /libiberty
parent23db6ced33c245c38c147c31011bbafa392e4328 (diff)
downloadgcc-2d91f79dc990f81dcea89a5087cad566238b2456.zip
gcc-2d91f79dc990f81dcea89a5087cad566238b2456.tar.gz
gcc-2d91f79dc990f81dcea89a5087cad566238b2456.tar.bz2
Implement P0482R5, char8_t: A type for UTF-8 characters and strings
gcc/cp/ * cvt.c (type_promotes_to): Handle char8_t promotion. * decl.c (grokdeclarator): Handle invalid type specifier combinations involving char8_t. * lex.c (init_reswords): Add char8_t as a reserved word. * mangle.c (write_builtin_type): Add name mangling for char8_t (Du). * parser.c (cp_keyword_starts_decl_specifier_p) (cp_parser_simple_type_specifier): Recognize char8_t as a simple type specifier. (cp_parser_string_literal): Use char8_array_type_node for the type of CPP_UTF8STRING. (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system headers. * rtti.c (emit_support_tinfos): type_info support for char8_t. * tree.c (char_type_p): Recognize char8_t as a character type. * typeck.c (string_conv_p): Handle conversions of u8 string literals of char8_t type. (check_literal_operator_args): Handle UDLs with u8 string literals of char8_t type. * typeck2.c (ordinary_char_type_p): New. (digest_init_r): Disallow initializing a char array with a u8 string literal. gcc/c-family/ * c-common.c (c_common_reswords): Add char8_t. (fix_string_type): Use char8_t for the type of u8 string literals. (c_common_get_alias_set): char8_t doesn't alias. (c_common_nodes_and_builtins): Define char8_t as a builtin type in C++. (c_stddef_cpp_builtins): Add __CHAR8_TYPE__. (keyword_begins_type_specifier): Add RID_CHAR8. * c-common.h (rid): Add RID_CHAR8. (c_tree_index): Add CTI_CHAR8_TYPE and CTI_CHAR8_ARRAY_TYPE. Define D_CXX_CHAR8_T and D_CXX_CHAR8_T_FLAGS. Define char8_type_node and char8_array_type_node. * c-cppbuiltin.c (cpp_atomic_builtins): Predefine __GCC_ATOMIC_CHAR8_T_LOCK_FREE. (c_cpp_builtins): Predefine __cpp_char8_t. * c-lex.c (lex_string): Use char8_array_type_node as the type of CPP_UTF8STRING. (lex_charconst): Use char8_type_node as the type of CPP_UTF8CHAR. * c-opts.c: If not otherwise specified, enable -fchar8_t when targeting C++2a. * c.opt: Add the -fchar8_t command line option. libiberty/ * cp-demangle.c (cplus_demangle_builtin_types) (cplus_demangle_type): Add name demangling for char8_t (Du). * cp-demangle.h: Increase D_BUILTIN_TYPE_COUNT to accommodate the new char8_t type. From-SVN: r267923
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog7
-rw-r--r--libiberty/cp-demangle.c18
-rw-r--r--libiberty/cp-demangle.h2
3 files changed, 20 insertions, 7 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2206b91..bcc0227 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-14 Tom Honermann <tom@honermann.net>
+
+ * cp-demangle.c (cplus_demangle_builtin_types)
+ (cplus_demangle_type): Add name demangling for char8_t (Du).
+ * cp-demangle.h: Increase D_BUILTIN_TYPE_COUNT to accommodate the
+ new char8_t type.
+
2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
PR other/16615
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index ddcd3be..b34b485 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2364,9 +2364,10 @@ cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT] =
/* 27 */ { NL ("decimal64"), NL ("decimal64"), D_PRINT_DEFAULT },
/* 28 */ { NL ("decimal128"), NL ("decimal128"), D_PRINT_DEFAULT },
/* 29 */ { NL ("half"), NL ("half"), D_PRINT_FLOAT },
- /* 30 */ { NL ("char16_t"), NL ("char16_t"), D_PRINT_DEFAULT },
- /* 31 */ { NL ("char32_t"), NL ("char32_t"), D_PRINT_DEFAULT },
- /* 32 */ { NL ("decltype(nullptr)"), NL ("decltype(nullptr)"),
+ /* 30 */ { NL ("char8_t"), NL ("char8_t"), D_PRINT_DEFAULT },
+ /* 31 */ { NL ("char16_t"), NL ("char16_t"), D_PRINT_DEFAULT },
+ /* 32 */ { NL ("char32_t"), NL ("char32_t"), D_PRINT_DEFAULT },
+ /* 33 */ { NL ("decltype(nullptr)"), NL ("decltype(nullptr)"),
D_PRINT_DEFAULT },
};
@@ -2654,14 +2655,19 @@ cplus_demangle_type (struct d_info *di)
ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[29]);
di->expansion += ret->u.s_builtin.type->len;
break;
+ case 'u':
+ /* char8_t */
+ ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[30]);
+ di->expansion += ret->u.s_builtin.type->len;
+ break;
case 's':
/* char16_t */
- ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[30]);
+ ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[31]);
di->expansion += ret->u.s_builtin.type->len;
break;
case 'i':
/* char32_t */
- ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[31]);
+ ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
di->expansion += ret->u.s_builtin.type->len;
break;
@@ -2687,7 +2693,7 @@ cplus_demangle_type (struct d_info *di)
case 'n':
/* decltype(nullptr) */
- ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
+ ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[33]);
di->expansion += ret->u.s_builtin.type->len;
break;
diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h
index b739bdf..92191cf 100644
--- a/libiberty/cp-demangle.h
+++ b/libiberty/cp-demangle.h
@@ -176,7 +176,7 @@ d_advance (struct d_info *di, int i)
extern const struct demangle_operator_info cplus_demangle_operators[];
#endif
-#define D_BUILTIN_TYPE_COUNT (33)
+#define D_BUILTIN_TYPE_COUNT (34)
CP_STATIC_IF_GLIBCPP_V3
const struct demangle_builtin_type_info