annotate gcc/testsuite/gcc.dg/utf-inc-init.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
kono
parents:
diff changeset
2 /* Test incremental initializers for char16_t/char32_t arrays. */
kono
parents:
diff changeset
3 /* { dg-do run { target int32plus } } */
kono
parents:
diff changeset
4 /* { dg-options "-std=gnu99" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 typedef __SIZE_TYPE__ size_t;
kono
parents:
diff changeset
7 typedef __CHAR16_TYPE__ char16_t;
kono
parents:
diff changeset
8 typedef __CHAR32_TYPE__ char32_t;
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 extern int memcmp (const void *, const void *, size_t);
kono
parents:
diff changeset
11 extern void abort (void);
kono
parents:
diff changeset
12 extern void exit (int);
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 struct A {
kono
parents:
diff changeset
15 char16_t S[6];
kono
parents:
diff changeset
16 int M;
kono
parents:
diff changeset
17 } a[] = { { { u"foo" }, 1 }, [0].S[2] = u'x', [0].S[4] = u'y' };
kono
parents:
diff changeset
18 struct A b[] = { { { u"foo" }, 1 }, [0] = { .S[0] = u'b' } };
kono
parents:
diff changeset
19 struct A c[] = { { { u"foo" }, 1 }, [0].S = { u"a" }, [0].M = 2 };
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 struct B {
kono
parents:
diff changeset
22 char32_t S[6];
kono
parents:
diff changeset
23 int M;
kono
parents:
diff changeset
24 } d[] = { { { U"foo" }, 1 }, [0].S[2] = U'x', [0].S[4] = U'y' };
kono
parents:
diff changeset
25 struct B e[] = { { { U"foo" }, 1 }, [0] = { .S[0] = U'b' } };
kono
parents:
diff changeset
26 struct B f[] = { { { U"foo" }, 1 }, [0].S = { U"a" }, [0].M = 2 };
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 int main (void)
kono
parents:
diff changeset
29 {
kono
parents:
diff changeset
30 if (memcmp (a[0].S, u"fox\0y", 6 * sizeof(char16_t)) || a[0].M != 1)
kono
parents:
diff changeset
31 abort ();
kono
parents:
diff changeset
32 if (memcmp (b[0].S, u"b\0\0\0\0", 6) || b[0].M)
kono
parents:
diff changeset
33 abort ();
kono
parents:
diff changeset
34 if (memcmp (c[0].S, u"a\0\0\0\0", 6) || c[0].M != 2)
kono
parents:
diff changeset
35 abort ();
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 if (memcmp (d[0].S, U"fox\0y", 6 * sizeof(char32_t)) || d[0].M != 1)
kono
parents:
diff changeset
38 abort ();
kono
parents:
diff changeset
39 if (memcmp (e[0].S, U"b\0\0\0\0", 6) || e[0].M)
kono
parents:
diff changeset
40 abort ();
kono
parents:
diff changeset
41 if (memcmp (f[0].S, U"a\0\0\0\0", 6) || f[0].M != 2)
kono
parents:
diff changeset
42 abort ();
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 exit(0);
kono
parents:
diff changeset
45 }