aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c
new file mode 100644
index 000000000..e287e0656
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/utf8-1.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-require-iconv "ISO-8859-2" } */
+/* { dg-options "-std=gnu99 -fexec-charset=ISO-8859-2" } */
+
+const char *str1 = "h\u00e1\U0000010Dky ";
+const char *str2 = "\u010d\u00E1rky\n";
+const char *str3 = u8"h\u00e1\U0000010Dky ";
+const char *str4 = u8"\u010d\u00E1rky\n";
+const char *str5 = "h\u00e1\U0000010Dky " "\u010d\u00E1rky\n";
+const char *str6 = u8"h\u00e1\U0000010Dky " "\u010d\u00E1rky\n";
+const char *str7 = "h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n";
+#define u8
+const char *str8 = u8"h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n";
+
+const char latin2_1[] = "\x68\xe1\xe8\x6b\x79\x20";
+const char latin2_2[] = "\xe8\xe1\x72\x6b\x79\n";
+const char utf8_1[] = "\x68\xc3\xa1\xc4\x8d\x6b\x79\x20";
+const char utf8_2[] = "\xc4\x8d\xc3\xa1\x72\x6b\x79\n";
+
+int
+main (void)
+{
+ if (__builtin_strcmp (str1, latin2_1) != 0
+ || __builtin_strcmp (str2, latin2_2) != 0
+ || __builtin_strcmp (str3, utf8_1) != 0
+ || __builtin_strcmp (str4, utf8_2) != 0
+ || __builtin_strncmp (str5, latin2_1, sizeof (latin2_1) - 1) != 0
+ || __builtin_strcmp (str5 + sizeof (latin2_1) - 1, latin2_2) != 0
+ || __builtin_strncmp (str6, utf8_1, sizeof (utf8_1) - 1) != 0
+ || __builtin_strcmp (str6 + sizeof (utf8_1) - 1, utf8_2) != 0
+ || __builtin_strncmp (str7, utf8_1, sizeof (utf8_1) - 1) != 0
+ || __builtin_strcmp (str7 + sizeof (utf8_1) - 1, utf8_2) != 0
+ || __builtin_strncmp (str8, utf8_1, sizeof (utf8_1) - 1) != 0
+ || __builtin_strcmp (str8 + sizeof (utf8_1) - 1, utf8_2) != 0)
+ __builtin_abort ();
+ if (sizeof ("a" u8"b"[0]) != 1
+ || sizeof (u8"a" "b"[0]) != 1
+ || sizeof (u8"a" u8"b"[0]) != 1
+ || sizeof ("a" "\u010d") != 3
+ || sizeof ("a" u8"\u010d") != 4
+ || sizeof (u8"a" "\u010d") != 4
+ || sizeof (u8"a" "\u010d") != 4)
+ __builtin_abort ();
+ return 0;
+}