* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / dfp / wtr-conversion-1.c
blobb85ff3e7c7d674b4ff75993bb248555d6f4c02ed
1 /* Test for -Wtraditional warnings on conversions by prototypes.
2 Note, gcc should omit these warnings in system header files.
3 Based on gcc.dg/wtr-conversion-1.c */
5 /* { dg-do compile } */
6 /* { dg-options "-Wtraditional-conversion" } */
8 extern void foo_i (int);
9 extern void foo_f (float);
10 extern void foo_ld (long double);
11 extern void foo_d32 (_Decimal32);
12 extern void foo_d64 (_Decimal64);
13 extern void foo_d128 (_Decimal128);
15 extern int i;
16 extern float f;
17 extern long double ld;
18 extern _Decimal32 d32;
19 extern _Decimal64 d64;
20 extern _Decimal128 d128;
22 void
23 testfunc1 ()
25 foo_i (i);
26 foo_i (d32); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
27 foo_i (d64); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
28 foo_i (d128); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
29 foo_d32 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
30 foo_d32 (f); /* { dg-warning "as '_Decimal32' rather than 'float'" "prototype conversion warning" } */
31 foo_d32 (ld); /* { dg-warning "as '_Decimal32' rather than 'long double'" "prototype conversion warning" } */
32 foo_d32 (d64); /* { dg-warning "as '_Decimal32' rather than '_Decimal64'" "prototype conversion warning" } */
33 foo_d32 (d128); /* { dg-warning "as '_Decimal32' rather than '_Decimal128'" "prototype conversion warning" } */
34 foo_d64 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
35 foo_d64 (f); /* { dg-warning "as '_Decimal64' rather than 'float'" "prototype conversion warning" } */
36 foo_d64 (ld); /* { dg-warning "as '_Decimal64' rather than 'long double'" "prototype conversion warning" } */
37 foo_d64 (d32); /* { dg-bogus "as '_Decimal64' rather than '_Decimal32'" "prototype conversion warning" } */
38 foo_d64 (d128); /* { dg-warning "as '_Decimal64' rather than '_Decimal128'" "prototype conversion warning" } */
39 foo_d128 (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
40 foo_d128 (f); /* { dg-warning "as '_Decimal128' rather than 'float'" "prototype conversion warning" } */
41 foo_d128 (ld); /* { dg-warning "as '_Decimal128' rather than 'long double'" "prototype conversion warning" } */
42 foo_d128 (d32); /* { dg-bogus "as '_Decimal128' rather than '_Decimal32'" "prototype conversion warning" } */
43 foo_d128 (d64); /* { dg-bogus "as '_Decimal128' rather than '_Decimal64'" "prototype conversion warning" } */
44 foo_d128 (d128); /* { dg-bogus "as '_Decimal128' rather than '_Decimal'" "prototype conversion warning" } */
47 # 54 "sys-header.h" 3
48 /* We are in system headers now, no -Wtraditional warnings should issue. */
50 void
51 testfunc2 ()
53 foo_i (i);
54 foo_i (d32);
55 foo_i (d64);
56 foo_i (d128);
57 foo_d32 (i);
58 foo_d32 (f);
59 foo_d32 (ld);
60 foo_d32 (d32);
61 foo_d32 (d64);
62 foo_d32 (d128);
63 foo_d64 (i);
64 foo_d64 (f);
65 foo_d64 (ld);
66 foo_d64 (d32);
67 foo_d64 (d64);
68 foo_d64 (d128);
69 foo_d128 (i);
70 foo_d128 (f);
71 foo_d128 (ld);
72 foo_d128 (d32);
73 foo_d128 (d64);
74 foo_d128 (d128);