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" } */ 6 7struct foo 8{ 9 int i; 10 long l; 11}; 12 13struct foo f0 = { 0, 0 }; 14static struct foo f1 = { 0, 0 }; 15 16void 17testfunc1 () 18{ 19 struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */ 20 static struct foo f4 = { 0, 0 }; 21 22 f3 = f4; 23 24 __extension__ ({ 25 struct foo f5 = { 0, 0 }; /* { dg-bogus "traditional C rejects automatic" "__extension__ disables warnings" } */ 26 f5.i = 0; 27 }); 28 29 { 30 struct foo f6 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "__extension__ reenables warnings" } */ 31 f6.i = 0; 32 } 33} 34 35# 35 "sys-header.h" 3 36/* We are in system headers now, no -Wtraditional warnings should issue. */ 37 38struct foo f7 = { 0, 0 }; 39static struct foo f8 = { 0, 0 }; 40 41void 42testfunc2 () 43{ 44 struct foo f9 = { 0, 0 }; 45 static struct foo f10 = { 0, 0 }; 46 47 f9 = f10; 48} 49