adlint 2.6.2 → 2.6.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 +149 -0
- data/MANIFEST +5 -0
- data/NEWS +20 -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/W0460.feature +27 -0
- data/features/code_check/W0534.feature +73 -0
- data/features/code_check/W0585.feature +135 -0
- data/features/code_check/W0599.feature +101 -1
- data/features/code_check/W0611.feature +138 -0
- data/features/code_check/W0708.feature +66 -0
- data/features/code_check/W1069.feature +27 -0
- data/features/code_check/W1073.feature +142 -0
- data/lib/adlint/c/ctrlexpr.rb +22 -16
- data/lib/adlint/c/interp.rb +32 -9
- data/lib/adlint/exam/c_builtin/c_check.rb +2597 -183
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +150 -14
- data/lib/adlint/version.rb +2 -2
- data/share/doc/developers_guide_ja.html +3 -3
- data/share/doc/developers_guide_ja.texi +1 -1
- data/share/doc/users_guide_en.html +10 -10
- data/share/doc/users_guide_en.texi +8 -8
- data/share/doc/users_guide_ja.html +10 -10
- data/share/doc/users_guide_ja.texi +8 -8
- metadata +7 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,152 @@
|
|
1
|
+
Thu Nov 8 13:01:03 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
|
+
|
3
|
+
* release.ga : 2.6.10
|
4
|
+
- Fix code checks so that duplicative messages of the same ID at the
|
5
|
+
same location can be unique till the function step-in analysis is
|
6
|
+
supported.
|
7
|
+
- Fix W1069 detection to output a warning message at correct location
|
8
|
+
when an incomplete if-else statements chain appears in a complete
|
9
|
+
if-else-statement.
|
10
|
+
- Fix W0708 detection not to warn when an address of the controlling
|
11
|
+
variable is passes to a function in the controlling part of
|
12
|
+
for-statement.
|
13
|
+
- Fix W0534, W0585, W0611 and w0708 detections to correctly deduct
|
14
|
+
the controlling variable.
|
15
|
+
- Add missing notification of the controlling expression value
|
16
|
+
reference.
|
17
|
+
- Fix W0460 detection to output outermost variable name when the
|
18
|
+
referencing variable is an array element or a member of struct or
|
19
|
+
union.
|
20
|
+
|
21
|
+
Wed Nov 7 15:17:28 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
22
|
+
|
23
|
+
* release.rc : 2.6.9
|
24
|
+
- Fix W0460 detection to output outermost variable name when the
|
25
|
+
referencing variable is an array element or a member of struct or
|
26
|
+
union.
|
27
|
+
- Add missing notification of the controlling expression value
|
28
|
+
reference and sequence-point at the end of the 1st expression
|
29
|
+
evaluation in the conditional-expression.
|
30
|
+
|
31
|
+
Wed Nov 7 14:10:54 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
32
|
+
|
33
|
+
* features/code_check/W0599.feature : Add W0599 specification to
|
34
|
+
reproduce a known bug.
|
35
|
+
|
36
|
+
* lib/adlint/c/interp.rb : Add missing notification of the controlling
|
37
|
+
expression value reference and sequence-point at the end of the 1st
|
38
|
+
expression evaluation in the conditional-expression.
|
39
|
+
|
40
|
+
Wed Nov 7 13:37:45 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
41
|
+
|
42
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0460 detection to output
|
43
|
+
outermost variable name when the referencing variable is an array
|
44
|
+
element or a member of struct or union.
|
45
|
+
|
46
|
+
Wed Nov 7 11:19:41 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
47
|
+
|
48
|
+
* release.rc : 2.6.7
|
49
|
+
- Move value reference notification of whole controlling expression
|
50
|
+
to notification suppressible section.
|
51
|
+
|
52
|
+
Wed Nov 7 11:15:59 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
53
|
+
|
54
|
+
* features/code_check/W0599.feature : Add W0599 specification to
|
55
|
+
reproduce a known bug.
|
56
|
+
|
57
|
+
* lib/adlint/c/ctrlexpr.rb : Move value reference notification of whole
|
58
|
+
controlling expression to notification suppressible section.
|
59
|
+
|
60
|
+
Wed Nov 7 10:01:25 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
61
|
+
|
62
|
+
* release.rc : 2.6.5
|
63
|
+
- Add missing sequence-point notification after referencing value of
|
64
|
+
whole controlling expression in the controlling-statement.
|
65
|
+
|
66
|
+
Wed Nov 7 09:57:52 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
67
|
+
|
68
|
+
* features/code_check/W0599.feature : Add W0599 specification to
|
69
|
+
reproduce a known bug.
|
70
|
+
|
71
|
+
* lib/adlint/c/interp.rb : Add missing sequence-point notification
|
72
|
+
after referencing value of whole controlling expression in the
|
73
|
+
controlling-statement.
|
74
|
+
|
75
|
+
Tue Nov 6 16:48:25 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
76
|
+
|
77
|
+
* release.rc : 2.6.3
|
78
|
+
- Fix code checks so that duplicative messages of the same ID at the
|
79
|
+
same location can be unique till the function step-in analysis is
|
80
|
+
supported.
|
81
|
+
- Fix W1069 detection to output a warning message at correct location
|
82
|
+
when an incomplete if-else statements chain appears in a complete
|
83
|
+
if-else-statement.
|
84
|
+
- Fix W0708 detection not to warn when an address of the controlling
|
85
|
+
variable is passes to a function in the controlling part of
|
86
|
+
for-statement.
|
87
|
+
- Fix W0534, W0585, W0611 and w0708 detections to correctly deduct
|
88
|
+
the controlling variable.
|
89
|
+
- Add missing notification of the controlling expression value
|
90
|
+
reference.
|
91
|
+
|
92
|
+
Tue Nov 6 16:17:03 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
93
|
+
|
94
|
+
* features/code_check/W1073.feature : Add W1073 specification to
|
95
|
+
reproduce a known bug.
|
96
|
+
|
97
|
+
* lib/adlint/c/interp.rb : Add missing notification of the controlling
|
98
|
+
expression value reference.
|
99
|
+
* lib/adlint/c/ctrlexpr.rb : Ditto.
|
100
|
+
|
101
|
+
Tue Nov 6 13:35:28 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
102
|
+
|
103
|
+
* features/code_check/W0611.feature : Add W0611 specification.
|
104
|
+
* MANIFEST : Ditto.
|
105
|
+
|
106
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0611 detection to
|
107
|
+
correctly deduct controlling variable of the iteration-statement.
|
108
|
+
|
109
|
+
Tue Nov 6 11:46:49 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
110
|
+
|
111
|
+
* features/code_check/W0534.feature : Add W0534 specification.
|
112
|
+
* MANIFEST : Ditto.
|
113
|
+
|
114
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0534 detection not to
|
115
|
+
warn about const variable appears in the controlling expression.
|
116
|
+
|
117
|
+
Tue Nov 6 10:57:45 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
118
|
+
|
119
|
+
* features/code_check/W0585.feature : Add W0585 specification.
|
120
|
+
* MANIFEST : Ditto.
|
121
|
+
|
122
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0585 detection not to
|
123
|
+
warn about const variable appears in the controlling expression.
|
124
|
+
|
125
|
+
Mon Nov 5 15:17:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
126
|
+
|
127
|
+
* features/code_check/W0708.feature : Add W0708 specification.
|
128
|
+
* MANIFEST : Ditto.
|
129
|
+
|
130
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0708 detection not to
|
131
|
+
warn when an address of the controlling variable is passes to a
|
132
|
+
function in the controlling part of for-statement.
|
133
|
+
|
134
|
+
Fri Nov 2 17:21:20 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
135
|
+
|
136
|
+
* features/code_check/W1069.feature : Add W1069 specification to
|
137
|
+
reproduce a known bug.
|
138
|
+
|
139
|
+
* lib/adlint/exam/c_builtin/c_check_shima.rb : Fix W1069 detection to
|
140
|
+
output a warning message at correct location when an incomplete
|
141
|
+
if-else statements chain appears in a complete if-else-statement.
|
142
|
+
|
143
|
+
Thu Nov 1 17:17:10 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
144
|
+
|
145
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix code checks so that
|
146
|
+
duplicative messages of the same ID at the same location can be
|
147
|
+
unique till the function step-in analysis is supported.
|
148
|
+
* lib/adlint/exam/c_builtin/c_check_shima.rb : Ditto.
|
149
|
+
|
1
150
|
Wed Oct 31 10:16:44 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
151
|
|
3
152
|
* release.ga : 2.6.2
|
data/MANIFEST
CHANGED
@@ -188,6 +188,7 @@ features/code_check/W0254.feature
|
|
188
188
|
features/code_check/W0425.feature
|
189
189
|
features/code_check/W0431.feature
|
190
190
|
features/code_check/W0432.feature
|
191
|
+
features/code_check/W0460.feature
|
191
192
|
features/code_check/W0477.feature
|
192
193
|
features/code_check/W0478.feature
|
193
194
|
features/code_check/W0479.feature
|
@@ -206,12 +207,15 @@ features/code_check/W0499.feature
|
|
206
207
|
features/code_check/W0500.feature
|
207
208
|
features/code_check/W0501.feature
|
208
209
|
features/code_check/W0502.feature
|
210
|
+
features/code_check/W0534.feature
|
209
211
|
features/code_check/W0573.feature
|
210
212
|
features/code_check/W0582.feature
|
211
213
|
features/code_check/W0583.feature
|
212
214
|
features/code_check/W0584.feature
|
215
|
+
features/code_check/W0585.feature
|
213
216
|
features/code_check/W0599.feature
|
214
217
|
features/code_check/W0606.feature
|
218
|
+
features/code_check/W0611.feature
|
215
219
|
features/code_check/W0635.feature
|
216
220
|
features/code_check/W0641.feature
|
217
221
|
features/code_check/W0643.feature
|
@@ -238,6 +242,7 @@ features/code_check/W0700.feature
|
|
238
242
|
features/code_check/W0703.feature
|
239
243
|
features/code_check/W0705.feature
|
240
244
|
features/code_check/W0707.feature
|
245
|
+
features/code_check/W0708.feature
|
241
246
|
features/code_check/W0711.feature
|
242
247
|
features/code_check/W0712.feature
|
243
248
|
features/code_check/W0713.feature
|
data/NEWS
CHANGED
@@ -21,6 +21,26 @@
|
|
21
21
|
|
22
22
|
++
|
23
23
|
|
24
|
+
=== \AdLint 2.6.10 is released (2012-11-08)
|
25
|
+
|
26
|
+
==== Changes since the 2.6.2 release
|
27
|
+
|
28
|
+
* Fix code checks so that duplicative messages of the same ID at the same
|
29
|
+
location can be unique till the function step-in analysis is supported
|
30
|
+
* Fix W1069 detection to output a warning message at correct location when an
|
31
|
+
incomplete if-else statements chain appears in a complete if-else-statement
|
32
|
+
* Fix W0708 detection not to warn when an address of the controlling variable
|
33
|
+
is passes to a function in the controlling part of for-statement
|
34
|
+
* Fix W0534, W0585, W0611 and w0708 detections to correctly deduct the
|
35
|
+
controlling variable
|
36
|
+
* Add missing notification of the controlling expression value reference
|
37
|
+
* Fix W0460 detection to output outermost variable name when the referencing
|
38
|
+
variable is an array element or a member of struct or union
|
39
|
+
|
40
|
+
See the file
|
41
|
+
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
42
|
+
for more details.
|
43
|
+
|
24
44
|
=== \AdLint 2.6.2 is released (2012-10-31)
|
25
45
|
|
26
46
|
==== Changes since the 2.6.0 release
|
@@ -40,10 +60,6 @@
|
|
40
60
|
* Fix the interpreter to place sequence-point at the end of the
|
41
61
|
return-statement evaluation
|
42
62
|
|
43
|
-
See the file
|
44
|
-
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
45
|
-
for more details.
|
46
|
-
|
47
63
|
=== \AdLint 2.6.0 is released (2012-10-22)
|
48
64
|
|
49
65
|
==== Changes since the 2.4.10 release
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: W0460
|
2
|
+
|
3
|
+
W0460 detects that a value of the variable is not possibly initialized.
|
4
|
+
|
5
|
+
Scenario: array element is not possibly initialized
|
6
|
+
Given a target source named "fixture.c" with:
|
7
|
+
"""
|
8
|
+
static int foo(void)
|
9
|
+
{
|
10
|
+
int a[5];
|
11
|
+
|
12
|
+
if (a[1] == 0) { /* W0459 */
|
13
|
+
a[0] = 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
return a[0]; /* W0460 */
|
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
|
+
| W1076 | 1 | 12 |
|
23
|
+
| W0459 | 5 | 14 |
|
24
|
+
| W0460 | 9 | 13 |
|
25
|
+
| W0629 | 1 | 12 |
|
26
|
+
| W0950 | 3 | 11 |
|
27
|
+
| W0628 | 1 | 12 |
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Feature: W0534
|
2
|
+
|
3
|
+
W0534 detects that a controlling variable of for-statement is not initialized
|
4
|
+
in the 1st part of for-statement.
|
5
|
+
|
6
|
+
Scenario: the 1st part of for-statement does not initialize the controlling
|
7
|
+
variable
|
8
|
+
Given a target source named "fixture.c" with:
|
9
|
+
"""
|
10
|
+
static int bar(int *);
|
11
|
+
|
12
|
+
static int foo(const int num)
|
13
|
+
{
|
14
|
+
int i = 0, j;
|
15
|
+
for (j = 0; (bar(&i)) && (i < num); i++) { /* W0534 */
|
16
|
+
j++;
|
17
|
+
}
|
18
|
+
return j;
|
19
|
+
}
|
20
|
+
"""
|
21
|
+
When I successfully run `adlint fixture.c` on noarch
|
22
|
+
Then the output should exactly match with:
|
23
|
+
| mesg | line | column |
|
24
|
+
| W1076 | 3 | 12 |
|
25
|
+
| W0534 | 6 | 10 |
|
26
|
+
| W0629 | 3 | 12 |
|
27
|
+
| W0425 | 5 | 16 |
|
28
|
+
| W0628 | 3 | 12 |
|
29
|
+
|
30
|
+
Scenario: the 1st part of for-statement is empty
|
31
|
+
Given a target source named "fixture.c" with:
|
32
|
+
"""
|
33
|
+
static int bar(int *);
|
34
|
+
|
35
|
+
static int foo(const int num)
|
36
|
+
{
|
37
|
+
int i = 0, j = 0;
|
38
|
+
for (; (bar(&i)) && (i < num); i++) { /* W0534 */
|
39
|
+
j++;
|
40
|
+
}
|
41
|
+
return j;
|
42
|
+
}
|
43
|
+
"""
|
44
|
+
When I successfully run `adlint fixture.c` on noarch
|
45
|
+
Then the output should exactly match with:
|
46
|
+
| mesg | line | column |
|
47
|
+
| W1076 | 3 | 12 |
|
48
|
+
| W0534 | 6 | 10 |
|
49
|
+
| W0629 | 3 | 12 |
|
50
|
+
| W0425 | 5 | 16 |
|
51
|
+
| W0628 | 3 | 12 |
|
52
|
+
|
53
|
+
Scenario: the 1st part of for-statement initializes the controlling variable
|
54
|
+
Given a target source named "fixture.c" with:
|
55
|
+
"""
|
56
|
+
static int bar(int *);
|
57
|
+
|
58
|
+
static int foo(const int num)
|
59
|
+
{
|
60
|
+
int i, j = 0;
|
61
|
+
for (i = 0; (bar(&i)) && (i < num); i++) { /* OK */
|
62
|
+
j++;
|
63
|
+
}
|
64
|
+
return j;
|
65
|
+
}
|
66
|
+
"""
|
67
|
+
When I successfully run `adlint fixture.c` on noarch
|
68
|
+
Then the output should exactly match with:
|
69
|
+
| mesg | line | column |
|
70
|
+
| W1076 | 3 | 12 |
|
71
|
+
| W0629 | 3 | 12 |
|
72
|
+
| W0425 | 5 | 12 |
|
73
|
+
| W0628 | 3 | 12 |
|
@@ -0,0 +1,135 @@
|
|
1
|
+
Feature: W0585
|
2
|
+
|
3
|
+
W0585 detects that a controlling variable of for-statement is not updated in
|
4
|
+
the 3rd part of for-statement.
|
5
|
+
|
6
|
+
Scenario: the 3rd part of for-statement does not increment the controlling
|
7
|
+
variable
|
8
|
+
Given a target source named "fixture.c" with:
|
9
|
+
"""
|
10
|
+
static int bar(int *);
|
11
|
+
|
12
|
+
static int foo(const int num)
|
13
|
+
{
|
14
|
+
int i, j = 0;
|
15
|
+
for (i = 0; (bar(&i)) && (i < num); j++) { /* W0585 */
|
16
|
+
}
|
17
|
+
return j;
|
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
|
+
| W0585 | 6 | 42 |
|
25
|
+
| W0629 | 3 | 12 |
|
26
|
+
| W0425 | 5 | 12 |
|
27
|
+
| W0628 | 3 | 12 |
|
28
|
+
|
29
|
+
Scenario: the 3rd part of for-statement is empty
|
30
|
+
Given a target source named "fixture.c" with:
|
31
|
+
"""
|
32
|
+
static int bar(int *);
|
33
|
+
|
34
|
+
static int foo(const int num)
|
35
|
+
{
|
36
|
+
int i, j = 0;
|
37
|
+
for (i = 0; (bar(&i)) && (i < num); ) { /* OK */
|
38
|
+
j++;
|
39
|
+
}
|
40
|
+
return j;
|
41
|
+
}
|
42
|
+
"""
|
43
|
+
When I successfully run `adlint fixture.c` on noarch
|
44
|
+
Then the output should exactly match with:
|
45
|
+
| mesg | line | column |
|
46
|
+
| W1076 | 3 | 12 |
|
47
|
+
| W0629 | 3 | 12 |
|
48
|
+
| W0425 | 5 | 12 |
|
49
|
+
| W0628 | 3 | 12 |
|
50
|
+
|
51
|
+
Scenario: the 3rd part of for-statement increments the controlling variable
|
52
|
+
Given a target source named "fixture.c" with:
|
53
|
+
"""
|
54
|
+
static int bar(int *);
|
55
|
+
|
56
|
+
static int foo(const int num)
|
57
|
+
{
|
58
|
+
int i, j = 0;
|
59
|
+
for (i = 0; (bar(&i)) && (i < num); i++) { /* OK */
|
60
|
+
j++;
|
61
|
+
}
|
62
|
+
return j;
|
63
|
+
}
|
64
|
+
"""
|
65
|
+
When I successfully run `adlint fixture.c` on noarch
|
66
|
+
Then the output should exactly match with:
|
67
|
+
| mesg | line | column |
|
68
|
+
| W1076 | 3 | 12 |
|
69
|
+
| W0629 | 3 | 12 |
|
70
|
+
| W0425 | 5 | 12 |
|
71
|
+
| W0628 | 3 | 12 |
|
72
|
+
|
73
|
+
Scenario: the 3rd part of c99-for-statement does not increment the
|
74
|
+
controlling variable
|
75
|
+
Given a target source named "fixture.c" with:
|
76
|
+
"""
|
77
|
+
static int bar(int *);
|
78
|
+
|
79
|
+
static int foo(const int num)
|
80
|
+
{
|
81
|
+
int j = 0;
|
82
|
+
for (int i = 0; (bar(&i)) && (i < num); j++) { /* W0585 */
|
83
|
+
}
|
84
|
+
return j;
|
85
|
+
}
|
86
|
+
"""
|
87
|
+
When I successfully run `adlint fixture.c` on noarch
|
88
|
+
Then the output should exactly match with:
|
89
|
+
| mesg | line | column |
|
90
|
+
| W1076 | 3 | 12 |
|
91
|
+
| W0585 | 6 | 46 |
|
92
|
+
| W0629 | 3 | 12 |
|
93
|
+
| W0628 | 3 | 12 |
|
94
|
+
|
95
|
+
Scenario: the 3rd part of c99-for-statement is empty
|
96
|
+
Given a target source named "fixture.c" with:
|
97
|
+
"""
|
98
|
+
static int bar(int *);
|
99
|
+
|
100
|
+
static int foo(const int num)
|
101
|
+
{
|
102
|
+
int j = 0;
|
103
|
+
for (int i = 0; (bar(&i)) && (i < num); ) { /* OK */
|
104
|
+
j++;
|
105
|
+
}
|
106
|
+
return j;
|
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
|
+
| W1076 | 3 | 12 |
|
113
|
+
| W0629 | 3 | 12 |
|
114
|
+
| W0628 | 3 | 12 |
|
115
|
+
|
116
|
+
Scenario: the 3rd part of for-statement increments the controlling variable
|
117
|
+
Given a target source named "fixture.c" with:
|
118
|
+
"""
|
119
|
+
static int bar(int *);
|
120
|
+
|
121
|
+
static int foo(const int num)
|
122
|
+
{
|
123
|
+
int j = 0;
|
124
|
+
for (int i = 0; (bar(&i)) && (i < num); i++) { /* OK */
|
125
|
+
j++;
|
126
|
+
}
|
127
|
+
return j;
|
128
|
+
}
|
129
|
+
"""
|
130
|
+
When I successfully run `adlint fixture.c` on noarch
|
131
|
+
Then the output should exactly match with:
|
132
|
+
| mesg | line | column |
|
133
|
+
| W1076 | 3 | 12 |
|
134
|
+
| W0629 | 3 | 12 |
|
135
|
+
| W0628 | 3 | 12 |
|
@@ -7,7 +7,7 @@ Feature: W0599
|
|
7
7
|
Given a target source named "fixture.c" with:
|
8
8
|
"""
|
9
9
|
extern void bar(int, int, int);
|
10
|
-
|
10
|
+
|
11
11
|
static void foo(int a, int b, int *c)
|
12
12
|
{
|
13
13
|
b = (a + 1) + a++; /* W0599 */
|
@@ -69,3 +69,103 @@ Feature: W0599
|
|
69
69
|
| W1071 | 1 | 12 |
|
70
70
|
| W0629 | 1 | 12 |
|
71
71
|
| W0628 | 1 | 12 |
|
72
|
+
|
73
|
+
Scenario: object-specifier as a controlling expression and updating same
|
74
|
+
variable in the branch
|
75
|
+
Given a target source named "fixture.c" with:
|
76
|
+
"""
|
77
|
+
static void foo(int i)
|
78
|
+
{
|
79
|
+
if (i) {
|
80
|
+
i++; /* OK */
|
81
|
+
}
|
82
|
+
}
|
83
|
+
"""
|
84
|
+
When I successfully run `adlint fixture.c` on noarch
|
85
|
+
Then the output should exactly match with:
|
86
|
+
| mesg | line | column |
|
87
|
+
| W1076 | 1 | 13 |
|
88
|
+
| W0629 | 1 | 13 |
|
89
|
+
| W0114 | 3 | 5 |
|
90
|
+
| W0628 | 1 | 13 |
|
91
|
+
|
92
|
+
Scenario: assignment-expression as a controlling expression and updating same
|
93
|
+
variable in the branch
|
94
|
+
Given a target source named "fixture.c" with:
|
95
|
+
"""
|
96
|
+
extern int bar(void);
|
97
|
+
|
98
|
+
static void foo(int i)
|
99
|
+
{
|
100
|
+
while (i = bar()) {
|
101
|
+
i++; /* OK */
|
102
|
+
}
|
103
|
+
}
|
104
|
+
"""
|
105
|
+
When I successfully run `adlint fixture.c` on noarch
|
106
|
+
Then the output should exactly match with:
|
107
|
+
| mesg | line | column |
|
108
|
+
| W0118 | 1 | 12 |
|
109
|
+
| W1076 | 3 | 13 |
|
110
|
+
| W0629 | 3 | 13 |
|
111
|
+
| W0108 | 5 | 14 |
|
112
|
+
| W0114 | 5 | 5 |
|
113
|
+
| W0628 | 3 | 13 |
|
114
|
+
|
115
|
+
Scenario: assignment-expression as a controlling expression and updating same
|
116
|
+
variable in the branch
|
117
|
+
Given a target source named "fixture.c" with:
|
118
|
+
"""
|
119
|
+
extern int bar(int);
|
120
|
+
|
121
|
+
static void foo(void)
|
122
|
+
{
|
123
|
+
int i;
|
124
|
+
for (i = 0; i = bar(i); ) {
|
125
|
+
i++; /* OK */
|
126
|
+
}
|
127
|
+
i++; /* OK */
|
128
|
+
}
|
129
|
+
"""
|
130
|
+
When I successfully run `adlint fixture.c` on noarch
|
131
|
+
Then the output should exactly match with:
|
132
|
+
| mesg | line | column |
|
133
|
+
| W0118 | 1 | 12 |
|
134
|
+
| W1076 | 3 | 13 |
|
135
|
+
| W0708 | 7 | 10 |
|
136
|
+
| W0629 | 3 | 13 |
|
137
|
+
| W0108 | 6 | 19 |
|
138
|
+
| W0114 | 6 | 5 |
|
139
|
+
| W0628 | 3 | 13 |
|
140
|
+
|
141
|
+
Scenario: updating variable in the 1st expression of conditional-expression
|
142
|
+
Given a target source named "fixture.c" with:
|
143
|
+
"""
|
144
|
+
static int foo(int i)
|
145
|
+
{
|
146
|
+
return i++ ? i : 0; /* OK */
|
147
|
+
}
|
148
|
+
"""
|
149
|
+
When I successfully run `adlint fixture.c` on noarch
|
150
|
+
Then the output should exactly match with:
|
151
|
+
| mesg | line | column |
|
152
|
+
| W1076 | 1 | 12 |
|
153
|
+
| W0629 | 1 | 12 |
|
154
|
+
| W0114 | 3 | 13 |
|
155
|
+
| W0628 | 1 | 12 |
|
156
|
+
|
157
|
+
Scenario: updating variable in the 1st expression of conditional-expression
|
158
|
+
Given a target source named "fixture.c" with:
|
159
|
+
"""
|
160
|
+
static int foo(int i)
|
161
|
+
{
|
162
|
+
return i++ > 0 ? i : 0; /* OK */
|
163
|
+
}
|
164
|
+
"""
|
165
|
+
When I successfully run `adlint fixture.c` on noarch
|
166
|
+
Then the output should exactly match with:
|
167
|
+
| mesg | line | column |
|
168
|
+
| W1076 | 1 | 12 |
|
169
|
+
| W0629 | 1 | 12 |
|
170
|
+
| W0501 | 3 | 20 |
|
171
|
+
| W0628 | 1 | 12 |
|