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
);
17 extern long double ld
;
18 extern _Decimal32 d32
;
19 extern _Decimal64 d64
;
20 extern _Decimal128 d128
;
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" } */
48 /* We are in system headers now, no -Wtraditional warnings should issue. */