2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / utf-cvt.c
blobd6f18eeade72d5595d01387e5b8cb7176dd15203
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-require-effective-target int32plus } */
5 /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
7 typedef __CHAR16_TYPE__ char16_t;
8 typedef __CHAR32_TYPE__ char32_t;
10 extern void f_c (char);
11 extern void fsc (signed char);
12 extern void fuc (unsigned char);
13 extern void f_s (short);
14 extern void fss (signed short);
15 extern void fus (unsigned short);
16 extern void f_i (int);
17 extern void fsi (signed int);
18 extern void fui (unsigned int);
19 extern void f_l (long);
20 extern void fsl (signed long);
21 extern void ful (unsigned long);
22 extern void f_ll (long long);
23 extern void fsll (signed long long);
24 extern void full (unsigned long long);
26 void m (char16_t c0, char32_t c1)
28 f_c (c0); /* { dg-warning "alter its value" } */
29 fsc (c0); /* { dg-warning "alter its value" } */
30 fuc (c0); /* { dg-warning "alter its value" } */
31 f_s (c0); /* { dg-warning "change the sign" } */
32 fss (c0); /* { dg-warning "change the sign" } */
33 fus (c0);
34 f_i (c0);
35 fsi (c0);
36 fui (c0);
37 f_l (c0);
38 fsl (c0);
39 ful (c0);
40 f_ll (c0);
41 fsll (c0);
42 full (c0);
44 f_c (c1); /* { dg-warning "alter its value" } */
45 fsc (c1); /* { dg-warning "alter its value" } */
46 fuc (c1); /* { dg-warning "alter its value" } */
47 f_s (c1); /* { dg-warning "alter its value" } */
48 fss (c1); /* { dg-warning "alter its value" } */
49 fus (c1); /* { dg-warning "alter its value" } */
50 f_i (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
51 fsi (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
52 fui (c1);
53 f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
54 fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
55 ful (c1);
56 f_ll (c1);
57 fsll (c1);
58 full (c1);