2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / Wswitch-default.c
blob2d4e7994c25c992e6bbd0ff72b4a96f832d7e192
1 /* { dg-do compile } */
2 /* { dg-options "-Wswitch-default" } */
4 enum e { e1, e2 };
6 int
7 foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el,
8 enum e em, enum e en, enum e eo, enum e ep)
10 switch (i) /* { dg-warning "switch missing default case" } */
12 case 1: return 1;
13 case 2: return 2;
15 switch (j)
17 case 3: return 4;
18 case 4: return 3;
19 default: break;
21 switch (ei) /* { dg-warning "switch missing default case" } */
24 switch (ej)
26 default: break;
28 switch (ek) /* { dg-warning "switch missing default case" } */
30 case e1: return 1;
32 switch (el)
34 case e1: return 1;
35 default: break;
37 switch (em) /* { dg-warning "switch missing default case" } */
39 case e1: return 1;
40 case e2: return 2;
42 switch (en)
44 case e1: return 1;
45 case e2: return 2;
46 default: break;
48 switch (eo) /* { dg-warning "switch missing default case" } */
50 case e1: return 1;
51 case e2: return 2;
52 case 3: return 3;
54 switch (ep)
56 case e1: return 1;
57 case e2: return 2;
58 case 3: return 3;
59 default: break;
61 return 0;