OSDN Git Service

PR c/17844
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / wtr-label-1.c
1 /* Test for -Wtraditional warnings on label conflicts with identifiers.
2    Note, gcc should omit these warnings in system header files.
3    Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/24/2000.  */
4 /* { dg-do compile } */
5 /* { dg-options "-Wtraditional" } */
6
7 enum foo1 { a };
8 struct foo2 { int i; };
9 union foo3 { int j; };
10 int foo4;
11 typedef int foo5;
12
13 void
14 testfunc1 (foo6)
15      int foo6;
16 {
17   int foo7;
18
19  foo1:
20  foo2:
21  foo3:
22  foo4: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
23  foo5: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
24  foo6: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
25  foo7: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
26  testfunc1: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
27  a: /* { dg-warning "traditional C lacks" "label conflicts with identifier" } */
28  i:
29  j: ;
30 }
31   
32 # 32 "sys-header.h" 3
33 /* We are in system headers now, no -Wtraditional warnings should issue.  */
34
35 void
36 testfunc2 (foo6)
37      int foo6;
38 {
39   int foo7;
40
41  foo1:
42  foo2:
43  foo3:
44  foo4:
45  foo5:
46  foo6:
47  foo7:
48  testfunc2:
49  a:
50  i:
51  j: ;
52 }