diff options
author | Tom Honermann <tom@honermann.net> | 2019-01-17 20:43:38 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-01-17 15:43:38 -0500 |
commit | 17ad43dd4c5dc1a39165a6b2108f4ea793e15eed (patch) | |
tree | 4985f32cf568ffe5e45c2d6f029141b9362830cd /gcc/testsuite/gcc.dg/utf-array-short-wchar.c | |
parent | f18aa3a4078f83540903c5d1f5c4ad0e25597ab1 (diff) | |
download | gcc-17ad43dd4c5dc1a39165a6b2108f4ea793e15eed.zip gcc-17ad43dd4c5dc1a39165a6b2108f4ea793e15eed.tar.gz gcc-17ad43dd4c5dc1a39165a6b2108f4ea793e15eed.tar.bz2 |
Improve the C error for mismatched array string literal initialization.
* c-typeck.c (digest_init): Revised the error message produced for
ill-formed cases of array initialization with a string literal.
(error_init): Make variadic.
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r268047
Diffstat (limited to 'gcc/testsuite/gcc.dg/utf-array-short-wchar.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/utf-array-short-wchar.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c index ec47812..a582e71 100644 --- a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c +++ b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c @@ -10,33 +10,37 @@ typedef __CHAR16_TYPE__ char16_t; typedef __CHAR32_TYPE__ char32_t; const char s_0[] = "ab"; -const char s_1[] = u"ab"; /* { dg-error "from wide string" } */ -const char s_2[] = U"ab"; /* { dg-error "from wide string" } */ -const char s_3[] = L"ab"; /* { dg-error "from wide string" } */ +const char s_1[] = u"ab"; /* { dg-error "from a string literal with type array of" } */ +const char s_2[] = U"ab"; /* { dg-error "from a string literal with type array of" } */ +const char s_3[] = L"ab"; /* { dg-error "from a string literal with type array of" } */ +const char s_4[] = u8"ab"; -const char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */ +const char16_t s16_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */ const char16_t s16_1[] = u"ab"; -const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */ +const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type array of" } */ const char16_t s16_3[] = L"ab"; +const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char16_t s16_4[0] = u"ab"; /* { dg-warning "chars is too long" } */ -const char16_t s16_5[1] = u"ab"; /* { dg-warning "chars is too long" } */ -const char16_t s16_6[2] = u"ab"; -const char16_t s16_7[3] = u"ab"; -const char16_t s16_8[4] = u"ab"; +const char16_t s16_5[0] = u"ab"; /* { dg-warning "chars is too long" } */ +const char16_t s16_6[1] = u"ab"; /* { dg-warning "chars is too long" } */ +const char16_t s16_7[2] = u"ab"; +const char16_t s16_8[3] = u"ab"; +const char16_t s16_9[4] = u"ab"; -const char32_t s32_0[] = "ab"; /* { dg-error "from non-wide" } */ -const char32_t s32_1[] = u"ab"; /* { dg-error "from incompatible" } */ +const char32_t s32_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */ +const char32_t s32_1[] = u"ab"; /* { dg-error "from a string literal with type array of" } */ const char32_t s32_2[] = U"ab"; -const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */ +const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of" } */ +const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ -const char32_t s32_4[0] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_5[1] = U"ab"; /* { dg-warning "chars is too long" } */ -const char32_t s32_6[2] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_7[3] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const char32_t s32_8[4] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_5[0] = U"ab"; /* { dg-warning "chars is too long" } */ +const char32_t s32_6[1] = U"ab"; /* { dg-warning "chars is too long" } */ +const char32_t s32_7[2] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_8[3] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ +const char32_t s32_9[4] = U"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */ -const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */ +const wchar_t sw_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */ const wchar_t sw_1[] = u"ab"; -const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */ +const wchar_t sw_2[] = U"ab"; /* { dg-error "from a string literal with type array of" } */ const wchar_t sw_3[] = L"ab"; +const wchar_t sw_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */ |