diff options
author | Edward Smith-Rowland <3dw4rd@verizon.net> | 2015-06-30 12:58:48 +0000 |
---|---|---|
committer | Edward Smith-Rowland <emsr@gcc.gnu.org> | 2015-06-30 12:58:48 +0000 |
commit | fe95b0366a02855988d4c626de2045dae6e11502 (patch) | |
tree | 8b22f058594c24d03fcb8f25908876f4764a4e03 /libcpp/include/cpplib.h | |
parent | 5b00d9211625c18148d3bacdc53c9f527557d063 (diff) | |
download | gcc-fe95b0366a02855988d4c626de2045dae6e11502.zip gcc-fe95b0366a02855988d4c626de2045dae6e11502.tar.gz gcc-fe95b0366a02855988d4c626de2045dae6e11502.tar.bz2 |
Implement N4197 - Adding u8 character literals
libcpp:
2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement N4197 - Adding u8 character literals
* include/cpplib.h (UTF8CHAR, UTF8CHAR_USERDEF): New cpp tokens;
(struct cpp_options): Add utf8_char_literals.
* init.c (struct lang_flags): Add utf8_char_literals;
(struct lang_flags lang_defaults): Add column for utf8_char_literals.
* macro.c (stringify_arg()): Treat CPP_UTF8CHAR token;
* expr.c (cpp_userdef_char_remove_type(), cpp_userdef_char_add_type()):
Treat CPP_UTF8CHAR_USERDEF, CPP_UTF8CHAR tokens;
(cpp_userdef_char_p()): Treat CPP_UTF8CHAR_USERDEF token;
(eval_token(), _cpp_parse_expr()): Treat CPP_UTF8CHAR token.
* lex.c (lex_string(), _cpp_lex_direct()): Include CPP_UTF8CHAR tokens.
* charset.c (converter_for_type(), cpp_interpret_charconst()):
Treat CPP_UTF8CHAR token.
gcc/c-family:
2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement N4197 - Adding u8 character literals
* c-family/c-ada-spec.c (print_ada_macros()): Treat CPP_UTF8CHAR
like CPP_CHAR.
* c-family/c-common.c (c_parse_error()): print CPP_UTF8CHAR
and CPP_UTF8CHAR_USERDEF tokens.
* c-family/c-lex.c (c_lex_with_flags()): Treat CPP_UTF8CHAR_USERDEF
and CPP_UTF8CHAR tokens; (lex_charconst()): Treat CPP_UTF8CHAR token.
gcc/cp:
2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement N4197 - Adding u8 character literals
* parser.c (cp_parser_primary_expression()): Treat CPP_UTF8CHAR
and CPP_UTF8CHAR_USERDEF tokens;
(cp_parser_parenthesized_expression_list()): Treat CPP_UTF8CHAR token.
gcc/testsuite:
2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement N4197 - Adding u8 character literals
* g++.dg/cpp1z/utf8.C: New.
* g++.dg/cpp1z/utf8-neg.C: New.
* g++.dg/cpp1z/udlit-utf8char.C: New.
From-SVN: r225185
Diffstat (limited to 'libcpp/include/cpplib.h')
-rw-r--r-- | libcpp/include/cpplib.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 1b1a53c..5eaea6b 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -119,6 +119,7 @@ struct _cpp_file; TK(WCHAR, LITERAL) /* L'char' */ \ TK(CHAR16, LITERAL) /* u'char' */ \ TK(CHAR32, LITERAL) /* U'char' */ \ + TK(UTF8CHAR, LITERAL) /* u8'char' */ \ TK(OTHER, LITERAL) /* stray punctuation */ \ \ TK(STRING, LITERAL) /* "string" */ \ @@ -133,6 +134,7 @@ struct _cpp_file; TK(WCHAR_USERDEF, LITERAL) /* L'char'_suffix - C++-0x */ \ TK(CHAR16_USERDEF, LITERAL) /* u'char'_suffix - C++-0x */ \ TK(CHAR32_USERDEF, LITERAL) /* U'char'_suffix - C++-0x */ \ + TK(UTF8CHAR_USERDEF, LITERAL) /* u8'char'_suffix - C++-0x */ \ TK(STRING_USERDEF, LITERAL) /* "string"_suffix - C++-0x */ \ TK(WSTRING_USERDEF, LITERAL) /* L"string"_suffix - C++-0x */ \ TK(STRING16_USERDEF, LITERAL) /* u"string"_suffix - C++-0x */ \ @@ -339,6 +341,9 @@ struct cpp_options /* Nonzero means process u/U prefix literals (UTF-16/32). */ unsigned char uliterals; + /* Nonzero means process u8 prefixed character literals (UTF-8). */ + unsigned char utf8_char_literals; + /* Nonzero means process r/R raw strings. If this is set, uliterals must be set as well. */ unsigned char rliterals; |