| 1 |
/* Test messages for -Wtraditional-conversion |
| 2 |
(based on gcc.dg/Wtraditional-conversion-2.c). */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-Wtraditional-conversion" } */ |
| 6 |
|
| 7 |
void fsi(signed int); |
| 8 |
void fd32(_Decimal32); |
| 9 |
void fd64(_Decimal64); |
| 10 |
void fd128(_Decimal128); |
| 11 |
|
| 12 |
struct s { |
| 13 |
void (*fsi)(signed int); |
| 14 |
void (*fd32)(_Decimal32); |
| 15 |
void (*fd64)(_Decimal64); |
| 16 |
void (*fd128)(_Decimal128); |
| 17 |
} x; |
| 18 |
|
| 19 |
signed int si; |
| 20 |
unsigned int ui; |
| 21 |
_Decimal32 d32; |
| 22 |
_Decimal64 d64; |
| 23 |
_Decimal128 d128; |
| 24 |
|
| 25 |
void |
| 26 |
g (void) |
| 27 |
{ |
| 28 |
fsi(d32); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */ |
| 29 |
x.fsi(d32); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */ |
| 30 |
fsi(d64); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */ |
| 31 |
x.fsi(d64); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */ |
| 32 |
fsi(d128); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */ |
| 33 |
x.fsi(d128); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */ |
| 34 |
fd32(si); /* { dg-warning "passing argument 1 of 'fd32' as floating rather than integer due to prototype" } */ |
| 35 |
x.fd32(si); /* { dg-warning "passing argument 1 of 'x.fd32' as floating rather than integer due to prototype" } */ |
| 36 |
fd64(ui); /* { dg-warning "passing argument 1 of 'fd64' as floating rather than integer due to prototype" } */ |
| 37 |
x.fd64(ui); /* { dg-warning "passing argument 1 of 'x.fd64' as floating rather than integer due to prototype" } */ |
| 38 |
fd128(si); /* { dg-warning "passing argument 1 of 'fd128' as floating rather than integer due to prototype" } */ |
| 39 |
x.fd128(ui); /* { dg-warning "passing argument 1 of 'x.fd128' as floating rather than integer due to prototype" } */ |
| 40 |
fd32(1.0); /* { dg-warning "passing argument 1 of 'fd32' as '_Decimal32' rather than 'double' due to prototype" } */ |
| 41 |
x.fd32(1.0); /* { dg-warning "passing argument 1 of 'x.fd32' as '_Decimal32' rather than 'double' due to prototype" } */ |
| 42 |
fd64(1.0); /* { dg-warning "passing argument 1 of 'fd64' as '_Decimal64' rather than 'double' due to prototype" } */ |
| 43 |
x.fd64(1.0); /* { dg-warning "passing argument 1 of 'x.fd64' as '_Decimal64' rather than 'double' due to prototype" } */ |
| 44 |
fd128(1.0); /* { dg-warning "passing argument 1 of 'fd128' as '_Decimal128' rather than 'double' due to prototype" } */ |
| 45 |
x.fd128(1.0); /* { dg-warning "passing argument 1 of 'x.fd128' as '_Decimal128' rather than 'double' due to prototype" } */ |
| 46 |
} |