testsuite: i386: adapt to -std=gnu23 default change
[official-gcc.git] / gcc / testsuite / gcc.dg / wtr-conversion-1.c
blob38e8d7d2085b16c7311ecefec3c8a9e82457144d
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);
12 extern int i;
13 extern float f;
14 extern long double ld;
15 extern __complex__ double cd;
17 void
18 testfunc1 ()
20 foo_i (i);
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);
32 foo_ld (ld);
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" } */
38 foo_cd (cd);
41 # 54 "sys-header.h" 3
42 /* We are in system headers now, no -Wtraditional warnings should issue. */
44 void
45 testfunc2 ()
47 foo_i (i);
48 foo_i (f);
49 foo_i (ld);
50 foo_i (cd);
52 foo_f (i);
53 foo_f (f);
54 foo_f (ld);
55 foo_f (cd);
57 foo_ld (i);
58 foo_ld (f);
59 foo_ld (ld);
60 foo_ld (cd);
62 foo_cd (i);
63 foo_cd (f);
64 foo_cd (ld);
65 foo_cd (cd);