aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/utf-array.c
diff options
context:
space:
mode:
authorKris Van Hees <kvanhees@gcc.gnu.org>2008-07-18 20:23:42 +0000
committerKris Van Hees <kvanhees@gcc.gnu.org>2008-07-18 20:23:42 +0000
commitc466b2cd136139e0e9fef6019fa6f136e23c7a4c (patch)
treeb27287a01b43f1b1f386e9e0c08cce428dc4e5ce /gcc/testsuite/gcc.dg/utf-array.c
parentab07512c507564f5386ed85b3b0cc47e56326e4a (diff)
downloadgcc-c466b2cd136139e0e9fef6019fa6f136e23c7a4c.zip
gcc-c466b2cd136139e0e9fef6019fa6f136e23c7a4c.tar.gz
gcc-c466b2cd136139e0e9fef6019fa6f136e23c7a4c.tar.bz2
c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__ and __CHAR32_TYPE__.
gcc/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> * c-common.c (c_stddef_cpp_builtins): Define __CHAR16_TYPE__ and __CHAR32_TYPE__. * c-typeck.c (digest_init): Support char16_t and char32_t. (set_nonincremental_init_from_string): Idem. gcc/cp/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> * rtti.c (emit_support_tinfos): Add char16_type_node and char32_type_node. * typeck2.c (digest_init): Support char16_t and char32_t. gcc/testsuite/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> Tests for char16_t and char32_t support. * g++.dg/ext/utf-array.C: New * g++.dg/ext/utf-array-short-wchar.C: New * g++.dg/ext/utf-rtti.C: New * g++.dg/ext/utf-type.c: New * gcc.dg/utf-array.c: New * gcc.dg/utf-array-short-wchar.c: New * gcc.dg/utf-inc-init.c: New * gcc.dg/utf-type.c: New libstdc++-v3/ChangeLog: 2008-07-16 Kris Van Hees <kris.van.hees@oracle.com> Holger Hopp <holger.hopp@sap.com> * config/abi/pre/gnu.ver: Support char16_t and char32_t. * testsuite/util/testsuite_abi.cc (check_version): Add CXXABI_1.3.3 to known_versions. From-SVN: r137965
Diffstat (limited to 'gcc/testsuite/gcc.dg/utf-array.c')
-rw-r--r--gcc/testsuite/gcc.dg/utf-array.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/utf-array.c b/gcc/testsuite/gcc.dg/utf-array.c
new file mode 100644
index 0000000..0e36e0d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/utf-array.c
@@ -0,0 +1,82 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+#include <wchar.h>
+
+typedef short unsigned int char16_t;
+typedef unsigned int 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 char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+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 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_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+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";
+const char32_t s32_7[3] = U"ab";
+const char32_t s32_8[4] = U"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Expected errors for char16_t/char32_t string literals. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+#include <wchar.h>
+
+typedef short unsigned int char16_t;
+typedef unsigned int 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 char16_t s16_0[] = "ab"; /* { dg-error "from non-wide" } */
+const char16_t s16_1[] = u"ab";
+const char16_t s16_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const char16_t s16_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+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 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_2[] = U"ab";
+const char32_t s32_3[] = L"ab"; /* { dg-error "from incompatible" } */
+
+const char16_t s32_4[0] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s32_5[1] = u"ab"; /* { dg-warning "chars is too long" } */
+const char16_t s32_6[2] = u"ab";
+const char16_t s32_7[3] = u"ab";
+const char16_t s32_8[4] = u"ab";
+
+const wchar_t sw_0[] = "ab"; /* { dg-error "from non-wide" } */
+const wchar_t sw_1[] = u"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_2[] = U"ab"; /* { dg-error "from incompatible" } */
+const wchar_t sw_3[] = L"ab";