adlint 3.0.8 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +295 -0
- data/MANIFEST +9 -0
- data/NEWS +25 -4
- data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
- data/etc/mesg.d/core/en_US/messages.yml +1 -1
- data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
- data/features/code_check/E0008.feature +20 -0
- data/features/code_check/W0093.feature +1 -1
- data/features/code_check/W0097.feature +30 -0
- data/features/code_check/W0100.feature +66 -0
- data/features/code_check/W0422.feature +157 -0
- data/features/code_check/W0459.feature +118 -0
- data/features/code_check/W0461.feature +115 -0
- data/features/code_check/W0610.feature +59 -0
- data/features/code_check/W0612.feature +29 -0
- data/features/code_check/W0613.feature +33 -0
- data/features/code_check/W0704.feature +25 -0
- data/features/code_check/W0705.feature +33 -0
- data/features/code_check/W1050.feature +43 -0
- data/features/code_check/W1071.feature +30 -0
- data/features/code_check/W9001.feature +24 -0
- data/lib/adlint/cc1/branch.rb +32 -9
- data/lib/adlint/cc1/builtin.rb +2 -2
- data/lib/adlint/cc1/conv.rb +33 -33
- data/lib/adlint/cc1/ctrlexpr.rb +30 -30
- data/lib/adlint/cc1/domain.rb +12 -4
- data/lib/adlint/cc1/environ.rb +2 -1
- data/lib/adlint/cc1/expr.rb +135 -125
- data/lib/adlint/cc1/format.rb +3 -3
- data/lib/adlint/cc1/interp.rb +123 -109
- data/lib/adlint/cc1/lexer.rb +44 -40
- data/lib/adlint/cc1/mediator.rb +2 -2
- data/lib/adlint/cc1/object.rb +121 -36
- data/lib/adlint/cc1/option.rb +1 -0
- data/lib/adlint/cc1/parser.rb +874 -845
- data/lib/adlint/cc1/parser.y +22 -2
- data/lib/adlint/cc1/syntax.rb +37 -18
- data/lib/adlint/cc1/type.rb +3 -3
- data/lib/adlint/cc1/value.rb +58 -50
- data/lib/adlint/cpp/lexer.rb +5 -1
- data/lib/adlint/cpp/macro.rb +30 -30
- data/lib/adlint/cpp/subst.rb +4 -4
- data/lib/adlint/exam/c_builtin/cc1_check.rb +172 -172
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +11 -11
- data/lib/adlint/exam/c_builtin/cpp_check.rb +2 -2
- data/lib/adlint/memo.rb +13 -13
- data/lib/adlint/prelude.rb +2 -2
- data/lib/adlint/version.rb +2 -2
- data/share/doc/developers_guide_ja.html +7 -5
- data/share/doc/developers_guide_ja.texi +5 -3
- data/share/doc/users_guide_en.html +3 -3
- data/share/doc/users_guide_en.texi +1 -1
- data/share/doc/users_guide_ja.html +3 -3
- data/share/doc/users_guide_ja.texi +1 -1
- metadata +11 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: W0093
|
2
2
|
|
3
|
-
W0093 detects that a division-by-zero
|
3
|
+
W0093 detects that a multiplicative-expression may cause division-by-zero.
|
4
4
|
|
5
5
|
Scenario: narrowing denominator variable by an iteration controlling
|
6
6
|
variable which has same value domain of the denominator
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: W0097
|
2
|
+
|
3
|
+
W0097 detects that a multiplicative-expression must cause division-by-zero.
|
4
|
+
|
5
|
+
Scenario: dividing by global constant variable initialized with 0
|
6
|
+
Given a target source named "fixture.c" with:
|
7
|
+
"""
|
8
|
+
static const int i = 0;
|
9
|
+
|
10
|
+
static int foo(void)
|
11
|
+
{
|
12
|
+
return 3 / i; /* W0097 */
|
13
|
+
}
|
14
|
+
|
15
|
+
static int bar(void)
|
16
|
+
{
|
17
|
+
return 3 / i; /* W0097 */
|
18
|
+
}
|
19
|
+
"""
|
20
|
+
When I successfully run `adlint fixture.c` on noarch
|
21
|
+
Then the output should exactly match with:
|
22
|
+
| mesg | line | column |
|
23
|
+
| W1076 | 3 | 12 |
|
24
|
+
| W0097 | 5 | 14 |
|
25
|
+
| W1076 | 8 | 12 |
|
26
|
+
| W0097 | 10 | 14 |
|
27
|
+
| W0629 | 3 | 12 |
|
28
|
+
| W0629 | 8 | 12 |
|
29
|
+
| W0628 | 3 | 12 |
|
30
|
+
| W0628 | 8 | 12 |
|
@@ -0,0 +1,66 @@
|
|
1
|
+
Feature: W0100
|
2
|
+
|
3
|
+
W0100 detects that a variable is not reassigned since the initial value is
|
4
|
+
assigned.
|
5
|
+
|
6
|
+
Scenario: reassigning value to an array element of the indefinite subscript
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
void foo(int i)
|
10
|
+
{
|
11
|
+
int a[3]; /* OK not W0100 */
|
12
|
+
a[i] = 0;
|
13
|
+
}
|
14
|
+
"""
|
15
|
+
When I successfully run `adlint fixture.c` on noarch
|
16
|
+
Then the output should exactly match with:
|
17
|
+
| mesg | line | column |
|
18
|
+
| W0117 | 1 | 6 |
|
19
|
+
| W0705 | 4 | 7 |
|
20
|
+
| W0104 | 1 | 14 |
|
21
|
+
| W0950 | 3 | 11 |
|
22
|
+
| W0628 | 1 | 6 |
|
23
|
+
|
24
|
+
Scenario: reassigning value to a nested array element of the indefinite
|
25
|
+
subscript
|
26
|
+
Given a target source named "fixture.c" with:
|
27
|
+
"""
|
28
|
+
void foo(int i)
|
29
|
+
{
|
30
|
+
int a[3][3]; /* OK not W0100 */
|
31
|
+
a[i][i] = 0;
|
32
|
+
}
|
33
|
+
"""
|
34
|
+
When I successfully run `adlint fixture.c` on noarch
|
35
|
+
Then the output should exactly match with:
|
36
|
+
| mesg | line | column |
|
37
|
+
| W0117 | 1 | 6 |
|
38
|
+
| W0705 | 4 | 7 |
|
39
|
+
| W0705 | 4 | 10 |
|
40
|
+
| W0104 | 1 | 14 |
|
41
|
+
| W0950 | 3 | 14 |
|
42
|
+
| W0950 | 3 | 11 |
|
43
|
+
| W0628 | 1 | 6 |
|
44
|
+
|
45
|
+
Scenario: only reference to a nested array element of the indefinite
|
46
|
+
subscript
|
47
|
+
Given a target source named "fixture.c" with:
|
48
|
+
"""
|
49
|
+
void foo(int i)
|
50
|
+
{
|
51
|
+
int a[3][3]; /* W0100 */
|
52
|
+
a[i][i];
|
53
|
+
}
|
54
|
+
"""
|
55
|
+
When I successfully run `adlint fixture.c` on noarch
|
56
|
+
Then the output should exactly match with:
|
57
|
+
| mesg | line | column |
|
58
|
+
| W0117 | 1 | 6 |
|
59
|
+
| W0705 | 4 | 7 |
|
60
|
+
| W0705 | 4 | 10 |
|
61
|
+
| W0100 | 3 | 9 |
|
62
|
+
| W0104 | 1 | 14 |
|
63
|
+
| W0950 | 3 | 14 |
|
64
|
+
| W0950 | 3 | 11 |
|
65
|
+
| W0085 | 4 | 5 |
|
66
|
+
| W0628 | 1 | 6 |
|
@@ -126,3 +126,160 @@ Feature: W0422
|
|
126
126
|
| W1071 | 3 | 6 |
|
127
127
|
| W0948 | 5 | 21 |
|
128
128
|
| W0628 | 3 | 6 |
|
129
|
+
|
130
|
+
Scenario: value of the global pointer is correctly null-checked by the
|
131
|
+
controlling-expression of while-statement
|
132
|
+
Given a target source named "fixture.c" with:
|
133
|
+
"""
|
134
|
+
int *ptr = NULL;
|
135
|
+
|
136
|
+
static void foo(void)
|
137
|
+
{
|
138
|
+
while (ptr) {
|
139
|
+
int i, *p = ptr;
|
140
|
+
i = *p; /* OK */
|
141
|
+
}
|
142
|
+
}
|
143
|
+
"""
|
144
|
+
When I successfully run `adlint fixture.c` on noarch
|
145
|
+
Then the output should exactly match with:
|
146
|
+
| mesg | line | column |
|
147
|
+
| W0117 | 1 | 6 |
|
148
|
+
| W1076 | 3 | 13 |
|
149
|
+
| W0100 | 6 | 17 |
|
150
|
+
| W0629 | 3 | 13 |
|
151
|
+
| W0114 | 5 | 5 |
|
152
|
+
| W0425 | 6 | 17 |
|
153
|
+
| W0628 | 3 | 13 |
|
154
|
+
| W0589 | 1 | 6 |
|
155
|
+
| W0593 | 1 | 6 |
|
156
|
+
|
157
|
+
Scenario: global pointer array as the controlling-expression of if-statement
|
158
|
+
Given a target source named "fixture.c" with:
|
159
|
+
"""
|
160
|
+
int *a[3] = { 0 };
|
161
|
+
|
162
|
+
int foo(void)
|
163
|
+
{
|
164
|
+
if (a[2] == NULL) {
|
165
|
+
return *a[2];
|
166
|
+
}
|
167
|
+
else if (a[2] == 1) {
|
168
|
+
return *a[2];
|
169
|
+
}
|
170
|
+
return *a[2]; /* OK not W0422 */
|
171
|
+
}
|
172
|
+
"""
|
173
|
+
When I successfully run `adlint fixture.c` on noarch
|
174
|
+
Then the output should exactly match with:
|
175
|
+
| mesg | line | column |
|
176
|
+
| W0117 | 1 | 6 |
|
177
|
+
| W0117 | 3 | 5 |
|
178
|
+
| W0421 | 6 | 16 |
|
179
|
+
| W9003 | 8 | 22 |
|
180
|
+
| W0027 | 8 | 19 |
|
181
|
+
| W1071 | 3 | 5 |
|
182
|
+
| W0950 | 1 | 8 |
|
183
|
+
| W1069 | 5 | 5 |
|
184
|
+
| W0628 | 3 | 5 |
|
185
|
+
| W0589 | 1 | 6 |
|
186
|
+
| W0593 | 1 | 6 |
|
187
|
+
|
188
|
+
Scenario: global pointer as the controlling-expression of if-statement
|
189
|
+
Given a target source named "fixture.c" with:
|
190
|
+
"""
|
191
|
+
int *ptr = 0;
|
192
|
+
|
193
|
+
int bar(void)
|
194
|
+
{
|
195
|
+
if (ptr == NULL) {
|
196
|
+
return *ptr;
|
197
|
+
}
|
198
|
+
else if (ptr == 1) {
|
199
|
+
return *ptr;
|
200
|
+
}
|
201
|
+
return *ptr; /* OK not W0422 */
|
202
|
+
}
|
203
|
+
"""
|
204
|
+
When I successfully run `adlint fixture.c` on noarch
|
205
|
+
Then the output should exactly match with:
|
206
|
+
| mesg | line | column |
|
207
|
+
| W0117 | 1 | 6 |
|
208
|
+
| W0117 | 3 | 5 |
|
209
|
+
| W0421 | 6 | 16 |
|
210
|
+
| W9003 | 8 | 21 |
|
211
|
+
| W0027 | 8 | 18 |
|
212
|
+
| W1071 | 3 | 5 |
|
213
|
+
| W1069 | 5 | 5 |
|
214
|
+
| W0628 | 3 | 5 |
|
215
|
+
| W0589 | 1 | 6 |
|
216
|
+
| W0593 | 1 | 6 |
|
217
|
+
|
218
|
+
Scenario: global pointer as the controlling-expression of if-statement in an
|
219
|
+
iteration-statement
|
220
|
+
Given a target source named "fixture.c" with:
|
221
|
+
"""
|
222
|
+
int *a[3] = { 0 };
|
223
|
+
|
224
|
+
int foo(unsigned int ui)
|
225
|
+
{
|
226
|
+
for (; ui < 3; ui++) {
|
227
|
+
if (a[ui] == NULL) {
|
228
|
+
break;
|
229
|
+
}
|
230
|
+
return *a[ui]; /* OK not W0422 */
|
231
|
+
}
|
232
|
+
return 0;
|
233
|
+
}
|
234
|
+
"""
|
235
|
+
When I successfully run `adlint fixture.c` on noarch
|
236
|
+
Then the output should exactly match with:
|
237
|
+
| mesg | line | column |
|
238
|
+
| W0117 | 1 | 6 |
|
239
|
+
| W0117 | 3 | 5 |
|
240
|
+
| W0534 | 5 | 10 |
|
241
|
+
| W0167 | 5 | 17 |
|
242
|
+
| W0147 | 6 | 15 |
|
243
|
+
| W0147 | 9 | 19 |
|
244
|
+
| W0104 | 3 | 22 |
|
245
|
+
| W1071 | 3 | 5 |
|
246
|
+
| W0950 | 1 | 8 |
|
247
|
+
| W0628 | 3 | 5 |
|
248
|
+
| W0589 | 1 | 6 |
|
249
|
+
| W0593 | 1 | 6 |
|
250
|
+
|
251
|
+
Scenario: global pointer as the controlling-expression of if-statement in an
|
252
|
+
iteration-statement
|
253
|
+
Given a target source named "fixture.c" with:
|
254
|
+
"""
|
255
|
+
int *ptr = 0;
|
256
|
+
|
257
|
+
int bar(unsigned int ui)
|
258
|
+
{
|
259
|
+
for (; ui < 3; ui++) {
|
260
|
+
if (ptr == NULL) {
|
261
|
+
break;
|
262
|
+
}
|
263
|
+
else if (ptr == 1) {
|
264
|
+
return *ptr; /* OK */
|
265
|
+
}
|
266
|
+
return *ptr; /* OK not W0422 */
|
267
|
+
}
|
268
|
+
}
|
269
|
+
"""
|
270
|
+
When I successfully run `adlint fixture.c` on noarch
|
271
|
+
Then the output should exactly match with:
|
272
|
+
| mesg | line | column |
|
273
|
+
| W0117 | 1 | 6 |
|
274
|
+
| W0117 | 3 | 5 |
|
275
|
+
| W0534 | 5 | 10 |
|
276
|
+
| W0167 | 5 | 17 |
|
277
|
+
| W9003 | 9 | 25 |
|
278
|
+
| W0027 | 9 | 22 |
|
279
|
+
| W0697 | 3 | 5 |
|
280
|
+
| W0104 | 3 | 22 |
|
281
|
+
| W1071 | 3 | 5 |
|
282
|
+
| W1069 | 6 | 9 |
|
283
|
+
| W0628 | 3 | 5 |
|
284
|
+
| W0589 | 1 | 6 |
|
285
|
+
| W0593 | 1 | 6 |
|
@@ -0,0 +1,118 @@
|
|
1
|
+
Feature: W0459
|
2
|
+
|
3
|
+
W0459 detects that the variable is not initialized at point of the expression
|
4
|
+
evaluation.
|
5
|
+
|
6
|
+
Scenario: variable initialization by a function via the output parameter
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
extern void foo(int ***);
|
10
|
+
extern void bar(int **);
|
11
|
+
|
12
|
+
void baz(int i)
|
13
|
+
{
|
14
|
+
int **p;
|
15
|
+
foo(i == 0 ? NULL : &p);
|
16
|
+
bar(p);
|
17
|
+
}
|
18
|
+
"""
|
19
|
+
When I successfully run `adlint fixture.c` on noarch
|
20
|
+
Then the output should exactly match with:
|
21
|
+
| mesg | line | column |
|
22
|
+
| W0118 | 1 | 13 |
|
23
|
+
| W0118 | 2 | 13 |
|
24
|
+
| W0117 | 4 | 6 |
|
25
|
+
| W0459 | 7 | 25 |
|
26
|
+
| W0100 | 6 | 11 |
|
27
|
+
| W0104 | 4 | 14 |
|
28
|
+
| W0501 | 7 | 16 |
|
29
|
+
| W0628 | 4 | 6 |
|
30
|
+
|
31
|
+
Scenario: reference to the uninitialized nested array element of the
|
32
|
+
indefinite subscript
|
33
|
+
Given a target source named "fixture.c" with:
|
34
|
+
"""
|
35
|
+
int foo(int i)
|
36
|
+
{
|
37
|
+
int a[3][3]; /* W0100 */
|
38
|
+
return a[i][i]; /* W0459 */
|
39
|
+
}
|
40
|
+
"""
|
41
|
+
When I successfully run `adlint fixture.c` on noarch
|
42
|
+
Then the output should exactly match with:
|
43
|
+
| mesg | line | column |
|
44
|
+
| W0117 | 1 | 5 |
|
45
|
+
| W0705 | 4 | 14 |
|
46
|
+
| W0705 | 4 | 17 |
|
47
|
+
| W0459 | 4 | 16 |
|
48
|
+
| W0100 | 3 | 9 |
|
49
|
+
| W0104 | 1 | 13 |
|
50
|
+
| W0950 | 3 | 14 |
|
51
|
+
| W0950 | 3 | 11 |
|
52
|
+
| W0628 | 1 | 5 |
|
53
|
+
|
54
|
+
Scenario: reference to the initialized array element of the indefinite
|
55
|
+
subscript
|
56
|
+
Given a target source named "fixture.c" with:
|
57
|
+
"""
|
58
|
+
int foo(int i)
|
59
|
+
{
|
60
|
+
int a[3] = { 0 };
|
61
|
+
|
62
|
+
if (i < 3) {
|
63
|
+
return a[i]; /* OK not W0459 */
|
64
|
+
}
|
65
|
+
return 0;
|
66
|
+
}
|
67
|
+
"""
|
68
|
+
When I successfully run `adlint fixture.c` on noarch
|
69
|
+
Then the output should exactly match with:
|
70
|
+
| mesg | line | column |
|
71
|
+
| W0117 | 1 | 5 |
|
72
|
+
| W0705 | 6 | 18 |
|
73
|
+
| W0100 | 3 | 9 |
|
74
|
+
| W0104 | 1 | 13 |
|
75
|
+
| W1071 | 1 | 5 |
|
76
|
+
| W0950 | 3 | 11 |
|
77
|
+
| W0628 | 1 | 5 |
|
78
|
+
|
79
|
+
Scenario: assign value to the variable in a switch-statement in an
|
80
|
+
iteration-statement
|
81
|
+
Given a target source named "fixture.c" with:
|
82
|
+
"""
|
83
|
+
extern void bar(int *);
|
84
|
+
|
85
|
+
int foo(int a[])
|
86
|
+
{
|
87
|
+
int i;
|
88
|
+
int j;
|
89
|
+
|
90
|
+
for (i = 0; a[i]; i++) {
|
91
|
+
switch (a[i]) {
|
92
|
+
case 0:
|
93
|
+
bar(&j);
|
94
|
+
break;
|
95
|
+
case 2:
|
96
|
+
bar(&j);
|
97
|
+
break;
|
98
|
+
default:
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
return j; /* OK but W0460 */
|
104
|
+
}
|
105
|
+
"""
|
106
|
+
When I successfully run `adlint fixture.c` on noarch
|
107
|
+
Then the output should exactly match with:
|
108
|
+
| mesg | line | column |
|
109
|
+
| W0118 | 1 | 13 |
|
110
|
+
| W0117 | 3 | 5 |
|
111
|
+
| W0459 | 14 | 17 |
|
112
|
+
| W0460 | 21 | 12 |
|
113
|
+
| W0104 | 3 | 13 |
|
114
|
+
| W9001 | 10 | 9 |
|
115
|
+
| W9001 | 11 | 13 |
|
116
|
+
| W9001 | 12 | 13 |
|
117
|
+
| W0114 | 8 | 5 |
|
118
|
+
| W0628 | 3 | 5 |
|
@@ -0,0 +1,115 @@
|
|
1
|
+
Feature: W0461
|
2
|
+
|
3
|
+
W0461 detects that a pointer to the undefined value is passed as an argument.
|
4
|
+
|
5
|
+
Scenario: pointer to the global constant array initialized with a
|
6
|
+
string-literal
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
static const char str[] = "str";
|
10
|
+
|
11
|
+
extern void foo(const void *);
|
12
|
+
|
13
|
+
static void bar(void)
|
14
|
+
{
|
15
|
+
foo(str); /* OK */
|
16
|
+
}
|
17
|
+
|
18
|
+
static void baz(void)
|
19
|
+
{
|
20
|
+
foo(str); /* OK */
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
When I successfully run `adlint fixture.c` on noarch
|
24
|
+
Then the output should exactly match with:
|
25
|
+
| mesg | line | column |
|
26
|
+
| W0118 | 3 | 13 |
|
27
|
+
| W1076 | 5 | 13 |
|
28
|
+
| W1076 | 10 | 13 |
|
29
|
+
| W0629 | 5 | 13 |
|
30
|
+
| W0629 | 10 | 13 |
|
31
|
+
| W0947 | 1 | 27 |
|
32
|
+
| W0628 | 5 | 13 |
|
33
|
+
| W0628 | 10 | 13 |
|
34
|
+
|
35
|
+
Scenario: pointer to the global constant explicitly sized array initialized
|
36
|
+
with a string-literal
|
37
|
+
Given a target source named "fixture.c" with:
|
38
|
+
"""
|
39
|
+
static const char str[4] = "str";
|
40
|
+
|
41
|
+
extern void foo(const void *);
|
42
|
+
|
43
|
+
static void bar(void)
|
44
|
+
{
|
45
|
+
foo(str); /* OK */
|
46
|
+
}
|
47
|
+
|
48
|
+
static void baz(void)
|
49
|
+
{
|
50
|
+
foo(str); /* OK */
|
51
|
+
}
|
52
|
+
"""
|
53
|
+
When I successfully run `adlint fixture.c` on noarch
|
54
|
+
Then the output should exactly match with:
|
55
|
+
| mesg | line | column |
|
56
|
+
| W0118 | 3 | 13 |
|
57
|
+
| W1076 | 5 | 13 |
|
58
|
+
| W1076 | 10 | 13 |
|
59
|
+
| W0629 | 5 | 13 |
|
60
|
+
| W0629 | 10 | 13 |
|
61
|
+
| W0947 | 1 | 28 |
|
62
|
+
| W0950 | 1 | 23 |
|
63
|
+
| W0628 | 5 | 13 |
|
64
|
+
| W0628 | 10 | 13 |
|
65
|
+
|
66
|
+
Scenario: array elements may be initialized according to a parameter value
|
67
|
+
Given a target source named "fixture.c" with:
|
68
|
+
"""
|
69
|
+
extern void bar(const int *);
|
70
|
+
|
71
|
+
void baz(int i)
|
72
|
+
{
|
73
|
+
int a[5];
|
74
|
+
|
75
|
+
for (; i < 2; i++) {
|
76
|
+
a[i] = i;
|
77
|
+
}
|
78
|
+
|
79
|
+
bar(a); /* OK not W0461 but W0462 */
|
80
|
+
}
|
81
|
+
"""
|
82
|
+
When I successfully run `adlint fixture.c` on noarch
|
83
|
+
Then the output should exactly match with:
|
84
|
+
| mesg | line | column |
|
85
|
+
| W0118 | 1 | 13 |
|
86
|
+
| W0117 | 3 | 6 |
|
87
|
+
| W0534 | 7 | 10 |
|
88
|
+
| W0705 | 8 | 11 |
|
89
|
+
| W0462 | 11 | 9 |
|
90
|
+
| W0950 | 5 | 11 |
|
91
|
+
| W0628 | 3 | 6 |
|
92
|
+
|
93
|
+
Scenario: array elements is initialized by an iteration-statement
|
94
|
+
Given a target source named "fixture.c" with:
|
95
|
+
"""
|
96
|
+
extern void bar(const int *);
|
97
|
+
|
98
|
+
void baz(void)
|
99
|
+
{
|
100
|
+
int a[3];
|
101
|
+
|
102
|
+
for (int i = 0; i < 3; i++) {
|
103
|
+
a[i] = i;
|
104
|
+
}
|
105
|
+
|
106
|
+
bar(a); /* OK */
|
107
|
+
}
|
108
|
+
"""
|
109
|
+
When I successfully run `adlint fixture.c` on noarch
|
110
|
+
Then the output should exactly match with:
|
111
|
+
| mesg | line | column |
|
112
|
+
| W0118 | 1 | 13 |
|
113
|
+
| W0117 | 3 | 6 |
|
114
|
+
| W0950 | 5 | 11 |
|
115
|
+
| W0628 | 3 | 6 |
|