Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/wtr-aggr-init-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 | |
7 struct foo | |
8 { | |
9 int i; | |
10 long l; | |
11 }; | |
12 | |
13 struct foo f0 = { 0, 0 }; | |
14 static struct foo f1 = { 0, 0 }; | |
15 | |
16 void | |
17 testfunc1 () | |
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 | |
38 struct foo f7 = { 0, 0 }; | |
39 static struct foo f8 = { 0, 0 }; | |
40 | |
41 void | |
42 testfunc2 () | |
43 { | |
44 struct foo f9 = { 0, 0 }; | |
45 static struct foo f10 = { 0, 0 }; | |
46 | |
47 f9 = f10; | |
48 } |