diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-19 21:41:15 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-19 21:41:15 +0000 |
commit | 538ba11a2394dd5e651ccc047aeced3ca4c95afd (patch) | |
tree | 2156a8d43e7b0cb0eb28776c7a735b606e1caea8 /gcc/testsuite/gcc.dg/utf8-2.c | |
parent | 5e9082a7a2a00296343284b155667ae01ca967be (diff) | |
download | gcc-538ba11a2394dd5e651ccc047aeced3ca4c95afd.tar.gz |
* charset.c (cpp_init_iconv): Initialize utf8_cset_desc.
(_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc
and char32_cset_desc.
(converter_for_type): Handle CPP_UTF8STRING.
(cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings.
* directives.c (get__Pragma_string): Handle CPP_UTF8STRING.
(parse_include): Reject raw strings.
* include/cpplib.h (CPP_UTF8STRING): New token type.
* internal.h (struct cpp_reader): Add utf8_cset_desc field.
* lex.c (lex_raw_string): New function.
(lex_string): Handle u8 string literals, call lex_raw_string
for raw string literals.
(_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R"
sequences.
* macro.c (stringify_arg): Handle CPP_UTF8STRING.
* c-common.c (c_parse_error): Handle CPP_UTF8STRING.
* c-lex.c (c_lex_with_flags): Likewise. Test C_LEX_STRING_NO_JOIN
instead of C_LEX_RAW_STRINGS.
(lex_string): Handle CPP_UTF8STRING.
* c-parser.c (c_parser_postfix_expression): Likewise.
* c-pragma.h (C_LEX_RAW_STRINGS): Rename to ...
(C_LEX_STRING_NO_JOIN): ... this.
* parser.c (cp_lexer_print_token, cp_parser_is_string_literal,
cp_parser_string_literal, cp_parser_primary_expression): Likewise.
(cp_lexer_get_preprocessor_token): Use C_LEX_STRING_JOIN instead
of C_LEX_RAW_STRINGS.
* gcc.dg/raw-string-1.c: New test.
* gcc.dg/raw-string-2.c: New test.
* gcc.dg/raw-string-3.c: New test.
* gcc.dg/raw-string-4.c: New test.
* gcc.dg/raw-string-5.c: New test.
* gcc.dg/raw-string-6.c: New test.
* gcc.dg/raw-string-7.c: New test.
* gcc.dg/utf8-1.c: New test.
* gcc.dg/utf8-2.c: New test.
* gcc.dg/utf-badconcat2.c: New test.
* gcc.dg/utf-dflt2.c: New test.
* gcc.dg/cpp/include6.c: New test.
* g++.dg/ext/raw-string-1.C: New test.
* g++.dg/ext/raw-string-2.C: New test.
* g++.dg/ext/raw-string-3.C: New test.
* g++.dg/ext/raw-string-4.C: New test.
* g++.dg/ext/raw-string-5.C: New test.
* g++.dg/ext/raw-string-6.C: New test.
* g++.dg/ext/raw-string-7.C: New test.
* g++.dg/ext/utf8-1.C: New test.
* g++.dg/ext/utf8-2.C: New test.
* g++.dg/ext/utf-badconcat2.C: New test.
* g++.dg/ext/utf-dflt2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152995 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/utf8-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/utf8-2.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/utf8-2.c b/gcc/testsuite/gcc.dg/utf8-2.c new file mode 100644 index 00000000000..9c0442fde3f --- /dev/null +++ b/gcc/testsuite/gcc.dg/utf8-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +#include <wchar.h> + +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; + +const char s0[] = u8"ab"; +const char16_t s1[] = u8"ab"; /* { dg-error "from non-wide" } */ +const char32_t s2[] = u8"ab"; /* { dg-error "from non-wide" } */ +const wchar_t s3[] = u8"ab"; /* { dg-error "from non-wide" } */ + +const char t0[0] = u8"ab"; /* { dg-warning "chars is too long" } */ +const char t1[1] = u8"ab"; /* { dg-warning "chars is too long" } */ +const char t2[2] = u8"ab"; +const char t3[3] = u8"ab"; +const char t4[4] = u8"ab"; + +const char u0[0] = u8"\u2160."; /* { dg-warning "chars is too long" } */ +const char u1[1] = u8"\u2160."; /* { dg-warning "chars is too long" } */ +const char u2[2] = u8"\u2160."; /* { dg-warning "chars is too long" } */ +const char u3[3] = u8"\u2160."; /* { dg-warning "chars is too long" } */ +const char u4[4] = u8"\u2160."; +const char u5[5] = u8"\u2160."; +const char u6[6] = u8"\u2160."; |