* gcc.dg/const-elim-1.c: xfail for xtensa.
[official-gcc.git] / gcc / testsuite / gcc.dg / wtr-aggr-init-1.c
blobf17531e8fb9875565c7048dd7002f738fbbd9e43
1 /* Test for -Wtraditional warnings on automatic aggregate initialization.
2 Note, gcc should omit these warnings in system header files.
3 By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */
4 /* { dg-do compile } */
5 /* { dg-options "-Wtraditional" } */
7 struct foo
9 int i;
10 long l;
13 struct foo f0 = { 0, 0 };
14 static struct foo f1 = { 0, 0 };
16 void
17 testfunc1 ()
19 struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */
20 static struct foo f4 = { 0, 0 };
22 f3 = f4;
24 __extension__ ({
25 struct foo f5 = { 0, 0 }; /* { dg-bogus "traditional C rejects automatic" "__extension__ disables warnings" } */
26 f5.i = 0;
27 });
30 struct foo f6 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "__extension__ reenables warnings" } */
31 f6.i = 0;
35 # 35 "sys-header.h" 3
36 /* We are in system headers now, no -Wtraditional warnings should issue. */
38 struct foo f7 = { 0, 0 };
39 static struct foo f8 = { 0, 0 };
41 void
42 testfunc2 ()
44 struct foo f9 = { 0, 0 };
45 static struct foo f10 = { 0, 0 };
47 f9 = f10;