1 /* Test for -Wtraditional warnings on conversions by prototypes.
2 Note, gcc should omit these warnings in system header files.
3 By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 4/09/2001. */
4 /* { dg-do compile } */
5 /* { dg-options "-Wtraditional-conversion" } */
7 extern void foo_i (int);
8 extern void foo_f (float);
9 extern void foo_ld (long double);
10 extern void foo_cd (__complex__
double);
14 extern long double ld
;
15 extern __complex__
double cd
;
21 foo_i (f
); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
22 foo_i (ld
); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
23 foo_i (cd
); /* { dg-warning "as integer rather than complex" "prototype conversion warning" } */
25 foo_f (i
); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
26 foo_f (f
); /* { dg-warning "as 'float' rather than 'double'" "prototype conversion warning" } */
27 foo_f (ld
); /* { dg-warning "as 'float' rather than 'double'" "prototype conversion warning" } */
28 foo_f (cd
); /* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
30 foo_ld (i
); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
31 foo_ld (f
); /* { dg-warning "as 'float' rather than 'double'" "small double" { target { "avr-*-*" } } } */
32 foo_ld (ld
);/* { dg-warning "as 'float' rather than 'double'" "small long double" { target { "avr-*-*" } } } */
33 foo_ld (cd
);/* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
35 foo_cd (i
); /* { dg-warning "as complex rather than integer" "prototype conversion warning" } */
36 foo_cd (f
); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
37 foo_cd (ld
); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
42 /* We are in system headers now, no -Wtraditional warnings should issue. */