2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / utf-cvt.c
blob109d231bff4ee209dadd73ca872922f2005369d6
1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2 /* Test the char16_t and char32_t promotion rules. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
6 typedef short unsigned int char16_t;
7 typedef unsigned int char32_t;
9 extern void f_c (char);
10 extern void fsc (signed char);
11 extern void fuc (unsigned char);
12 extern void f_s (short);
13 extern void fss (signed short);
14 extern void fus (unsigned short);
15 extern void f_i (int);
16 extern void fsi (signed int);
17 extern void fui (unsigned int);
18 extern void f_l (long);
19 extern void fsl (signed long);
20 extern void ful (unsigned long);
21 extern void f_ll (long long);
22 extern void fsll (signed long long);
23 extern void full (unsigned long long);
25 void m (char16_t c0, char32_t c1)
27 f_c (c0); /* { dg-warning "alter its value" } */
28 fsc (c0); /* { dg-warning "alter its value" } */
29 fuc (c0); /* { dg-warning "alter its value" } */
30 f_s (c0); /* { dg-warning "change the sign" } */
31 fss (c0); /* { dg-warning "change the sign" } */
32 fus (c0);
33 f_i (c0);
34 fsi (c0);
35 fui (c0);
36 f_l (c0);
37 fsl (c0);
38 ful (c0);
39 f_ll (c0);
40 fsll (c0);
41 full (c0);
43 f_c (c1); /* { dg-warning "alter its value" } */
44 fsc (c1); /* { dg-warning "alter its value" } */
45 fuc (c1); /* { dg-warning "alter its value" } */
46 f_s (c1); /* { dg-warning "alter its value" } */
47 fss (c1); /* { dg-warning "alter its value" } */
48 fus (c1); /* { dg-warning "alter its value" } */
49 f_i (c1); /* { dg-warning "change the sign" } */
50 fsi (c1); /* { dg-warning "change the sign" } */
51 fui (c1);
52 f_l (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */
53 fsl (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */
54 ful (c1);
55 f_ll (c1);
56 fsll (c1);
57 full (c1);