annotate gcc/testsuite/c-c++-common/pr66322.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
kono
parents:
diff changeset
1 /* PR c/66322 */
kono
parents:
diff changeset
2 /* { dg-do compile } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 #ifndef __cplusplus
kono
parents:
diff changeset
5 # define bool _Bool
kono
parents:
diff changeset
6 # define true 1
kono
parents:
diff changeset
7 # define false 0
kono
parents:
diff changeset
8 #endif
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 void
kono
parents:
diff changeset
11 nowarn (bool b)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 switch (b)
kono
parents:
diff changeset
14 ;
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 switch (b)
kono
parents:
diff changeset
17 {
kono
parents:
diff changeset
18 case true:
kono
parents:
diff changeset
19 case false:
kono
parents:
diff changeset
20 break;
kono
parents:
diff changeset
21 }
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 switch (b)
kono
parents:
diff changeset
24 {
kono
parents:
diff changeset
25 case true:
kono
parents:
diff changeset
26 break;
kono
parents:
diff changeset
27 }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 switch (b)
kono
parents:
diff changeset
30 {
kono
parents:
diff changeset
31 case true:
kono
parents:
diff changeset
32 default:
kono
parents:
diff changeset
33 break;
kono
parents:
diff changeset
34 }
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 switch (b)
kono
parents:
diff changeset
37 {
kono
parents:
diff changeset
38 case false:
kono
parents:
diff changeset
39 break;
kono
parents:
diff changeset
40 }
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 switch (b)
kono
parents:
diff changeset
43 {
kono
parents:
diff changeset
44 case false:
kono
parents:
diff changeset
45 default:
kono
parents:
diff changeset
46 break;
kono
parents:
diff changeset
47 }
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 switch (b)
kono
parents:
diff changeset
50 {
kono
parents:
diff changeset
51 default:
kono
parents:
diff changeset
52 break;
kono
parents:
diff changeset
53 }
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 switch (b)
kono
parents:
diff changeset
56 {
kono
parents:
diff changeset
57 case false ... true:
kono
parents:
diff changeset
58 break;
kono
parents:
diff changeset
59 }
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 switch (b)
kono
parents:
diff changeset
62 {
kono
parents:
diff changeset
63 case 1:
kono
parents:
diff changeset
64 switch (b)
kono
parents:
diff changeset
65 {
kono
parents:
diff changeset
66 case true:
kono
parents:
diff changeset
67 default:
kono
parents:
diff changeset
68 break;
kono
parents:
diff changeset
69 }
kono
parents:
diff changeset
70 default:
kono
parents:
diff changeset
71 break;
kono
parents:
diff changeset
72 }
kono
parents:
diff changeset
73 }
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 void
kono
parents:
diff changeset
76 warn (bool b)
kono
parents:
diff changeset
77 {
kono
parents:
diff changeset
78 switch (b) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
79 {
kono
parents:
diff changeset
80 case true:
kono
parents:
diff changeset
81 case false:
kono
parents:
diff changeset
82 default:
kono
parents:
diff changeset
83 break;
kono
parents:
diff changeset
84 }
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 switch (b) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
87 {
kono
parents:
diff changeset
88 case false ... true:
kono
parents:
diff changeset
89 default:
kono
parents:
diff changeset
90 break;
kono
parents:
diff changeset
91 }
kono
parents:
diff changeset
92 }
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 void
kono
parents:
diff changeset
95 warn2 (int n)
kono
parents:
diff changeset
96 {
kono
parents:
diff changeset
97 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
98 {
kono
parents:
diff changeset
99 case 0 ... 2: /* { dg-warning "upper value" "" { target c++ } } */
kono
parents:
diff changeset
100 default:
kono
parents:
diff changeset
101 break;
kono
parents:
diff changeset
102 }
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
105 {
kono
parents:
diff changeset
106 case 1 ... 10: /* { dg-warning "upper value" "" { target c++ } } */
kono
parents:
diff changeset
107 default:
kono
parents:
diff changeset
108 break;
kono
parents:
diff changeset
109 }
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
112 {
kono
parents:
diff changeset
113 case 2: /* { dg-warning "case label" "" { target c++ } } */
kono
parents:
diff changeset
114 break;
kono
parents:
diff changeset
115 }
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
118 {
kono
parents:
diff changeset
119 case 0:
kono
parents:
diff changeset
120 case 1:
kono
parents:
diff changeset
121 case -1: /* { dg-warning "case label" "" { target c++ } } */
kono
parents:
diff changeset
122 break;
kono
parents:
diff changeset
123 }
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
126 {
kono
parents:
diff changeset
127 case -1 ... 1: /* { dg-warning "lower value" "" { target c++ } } */
kono
parents:
diff changeset
128 break;
kono
parents:
diff changeset
129 }
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
132 {
kono
parents:
diff changeset
133 case -1 ... 0: /* { dg-warning "lower value" "" { target c++ } } */
kono
parents:
diff changeset
134 default:
kono
parents:
diff changeset
135 break;
kono
parents:
diff changeset
136 }
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 switch (n == 2) /* { dg-warning "switch condition has" } */
kono
parents:
diff changeset
139 {
kono
parents:
diff changeset
140 case -10 ... -1: /* { dg-warning "case label" "" { target c++ } } */
kono
parents:
diff changeset
141 default:
kono
parents:
diff changeset
142 break;
kono
parents:
diff changeset
143 }
kono
parents:
diff changeset
144 }