adlint 2.4.10 → 2.6.0
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 +209 -0
- data/MANIFEST +4 -0
- data/NEWS +19 -4
- data/etc/mesg.d/c_builtin/en_US/messages.yml +2 -2
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +2 -2
- 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/W0088.feature +153 -0
- data/features/code_check/W0582.feature +72 -0
- data/features/code_check/W0583.feature +93 -0
- data/features/code_check/W0584.feature +139 -0
- data/features/code_check/W0635.feature +0 -2
- data/features/code_check/W0722.feature +68 -0
- data/features/code_check/W0723.feature +1 -1
- data/features/code_check/W0732.feature +0 -15
- data/features/code_check/W0733.feature +0 -15
- data/features/code_check/W0734.feature +0 -36
- data/features/code_check/W0735.feature +0 -40
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W9003.feature +85 -0
- data/lib/adlint/c/conv.rb +32 -0
- data/lib/adlint/c/interp.rb +17 -1
- data/lib/adlint/c/mediator.rb +2 -0
- data/lib/adlint/c/syntax.rb +72 -0
- data/lib/adlint/c/type.rb +10 -3
- data/lib/adlint/exam/c_builtin/c_check.rb +164 -48
- data/lib/adlint/version.rb +3 -3
- 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 +12 -12
- data/share/doc/users_guide_en.texi +10 -10
- data/share/doc/users_guide_ja.html +12 -12
- data/share/doc/users_guide_ja.texi +10 -10
- metadata +6 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,212 @@
|
|
1
|
+
Mon Oct 22 15:02:29 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
|
+
|
3
|
+
* release.ga : 2.6.0
|
4
|
+
- Fix W0609 and w0610 detections not to over-warn about explicit
|
5
|
+
controlling expressions of for-statements by adding workarounds for
|
6
|
+
the interpreter.
|
7
|
+
- Fix W0088 detection not to warn about controlling expression of
|
8
|
+
for-statement.
|
9
|
+
- Fix W0723 detection in order to correctly warn about signed `-'
|
10
|
+
expression.
|
11
|
+
- Fix bad parameter type convertibility check and bad type
|
12
|
+
convertibility check of pointer to arbitrary types to void-pointer.
|
13
|
+
- Revise string representation of typedefed type so that message and
|
14
|
+
metric show typedefed type name itself.
|
15
|
+
- Clarify W9003 message text by adding destination type name of the
|
16
|
+
implicit conversion.
|
17
|
+
|
18
|
+
Mon Oct 22 11:07:37 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
19
|
+
|
20
|
+
* release.rc : 2.5.3
|
21
|
+
- Clarify W9003 message text by adding destination type name of the
|
22
|
+
implicit conversion.
|
23
|
+
|
24
|
+
Mon Oct 22 10:59:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
25
|
+
|
26
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W9003 message text by
|
27
|
+
adding destination type name of the implicit conversion.
|
28
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
29
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
30
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
31
|
+
* share/doc/users_guide_en.texi : Ditto.
|
32
|
+
|
33
|
+
Fri Oct 19 19:33:19 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
34
|
+
|
35
|
+
* release.rc : 2.5.2
|
36
|
+
- Fix W0582, W0583, W0584 and W9003 detections to warn about constant
|
37
|
+
pointers except for NULL.
|
38
|
+
|
39
|
+
Fri Oct 19 19:26:31 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
40
|
+
|
41
|
+
* lib/adlint/c/conv.rb : Fix #untyped_pointer_conversion? predicate
|
42
|
+
method to support consideration about converting value.
|
43
|
+
|
44
|
+
* features/code_check/W0582.feature : Add W0582 specification to
|
45
|
+
reproduce a known bug.
|
46
|
+
* features/code_check/W0583.feature : Add W0583 specification to
|
47
|
+
reproduce a known bug.
|
48
|
+
* features/code_check/W0584.feature : Add W0584 specification to
|
49
|
+
reproduce a known bug.
|
50
|
+
* features/code_check/W9003.feature : Add W9003 specification to
|
51
|
+
reproduce a known bug.
|
52
|
+
|
53
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0582, W0583, W0584 and
|
54
|
+
W9003 detections to warn about constant pointers except for NULL.
|
55
|
+
|
56
|
+
Fri Oct 19 16:19:35 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
57
|
+
|
58
|
+
* release.rc : 2.5.1
|
59
|
+
- Fix W0584 detection not to warn when the constant argument is
|
60
|
+
convertible to the corresponding parameter.
|
61
|
+
|
62
|
+
Fri Oct 19 14:59:29 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
63
|
+
|
64
|
+
* features/code_check/W0584.feature: Add W0584 specification to
|
65
|
+
reproduce a known bug.
|
66
|
+
|
67
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0584 detection not to
|
68
|
+
warn when the constant argument is convertible to the corresponding
|
69
|
+
parameter.
|
70
|
+
|
71
|
+
Fri Oct 19 13:43:34 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
72
|
+
|
73
|
+
* release.rc : 2.5.0
|
74
|
+
- Fix W0582, W0583 and W0584 detections not to warn about unmatched
|
75
|
+
argument which is considerd as untyped constant pointer such as
|
76
|
+
NULL or 0.
|
77
|
+
|
78
|
+
Fri Oct 19 13:33:28 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
79
|
+
|
80
|
+
* features/code_check/W0582.feature : Add W0582 specification to
|
81
|
+
reproduce a known bug.
|
82
|
+
* MANIFEST : Ditto.
|
83
|
+
|
84
|
+
* features/code_check/W0583.feature : Add W0583 specification to
|
85
|
+
reproduce a known bug.
|
86
|
+
|
87
|
+
* features/code_check/W0584.feature : Add W0584 specification to
|
88
|
+
reproduce a known bug.
|
89
|
+
* MANIFEST : Ditto.
|
90
|
+
|
91
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0582, W0583 and W0584
|
92
|
+
detections not to warn about unmatched argument which is considerd as
|
93
|
+
untyped constant pointer such as NULL or 0.
|
94
|
+
|
95
|
+
Fri Oct 19 11:25:11 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
96
|
+
|
97
|
+
* lib/adlint/c/conv.rb : Move #untyped_pointer_conversion? predicate
|
98
|
+
method to C::Conversion module from CBuiltin::W9003 class.
|
99
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Ditto.
|
100
|
+
|
101
|
+
Thu Oct 18 16:45:28 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
102
|
+
|
103
|
+
* release.rc : 2.4.17
|
104
|
+
- Fix W0088 detection not to warn about argument expressions in a
|
105
|
+
function-call-expression.
|
106
|
+
|
107
|
+
Thu Oct 18 16:35:48 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
108
|
+
|
109
|
+
* features/code_check/W0088.feature : Add W0088 specification to
|
110
|
+
reproduce a known bug.
|
111
|
+
|
112
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0088 detection not to
|
113
|
+
warn about argument expressions in a function-call-expression.
|
114
|
+
|
115
|
+
Thu Oct 18 15:17:34 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
116
|
+
|
117
|
+
* release.rc : 2.4.15
|
118
|
+
- Fix expression-statement evaluation in order to notify end of the
|
119
|
+
evaluation at all times.
|
120
|
+
|
121
|
+
Thu Oct 18 15:09:13 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
122
|
+
|
123
|
+
* lib/adlint/c/interp.rb : Fix expression-statement evaluation in order
|
124
|
+
to notify end of the evaluation at all times.
|
125
|
+
|
126
|
+
Thu Oct 18 14:07:33 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
127
|
+
|
128
|
+
* release.rc : 2.4.13
|
129
|
+
- Revise W9003 detection not to warn about implicit conversion of
|
130
|
+
untyped constant pointers such as NULL or 0.
|
131
|
+
- Fix W0088 detection not to skip checking when an outmost expression
|
132
|
+
has side-effect but it contains problematic logical-and-expression
|
133
|
+
or logical-or-expression.
|
134
|
+
|
135
|
+
Thu Oct 18 14:03:00 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
136
|
+
|
137
|
+
* features/code_check/W0088.feature : Add W0088 specification to
|
138
|
+
reproduce a known bug.
|
139
|
+
|
140
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0088 detection not to
|
141
|
+
skip checking when an outmost expression has side-effect but it
|
142
|
+
contains problematic logical-and-expression or logical-or-expression.
|
143
|
+
|
144
|
+
Thu Oct 18 13:19:22 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
145
|
+
|
146
|
+
* features/code_check/W9003.feature : Add W9003 specification of
|
147
|
+
implicit convertion of constant pointers.
|
148
|
+
|
149
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Revise W9003 detection not to
|
150
|
+
warn about implicit conversion of untyped constant pointers such as
|
151
|
+
NULL or 0.
|
152
|
+
|
153
|
+
Wed Oct 17 18:28:03 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
154
|
+
|
155
|
+
* release.rc : 2.4.11
|
156
|
+
- Fix W0609 and w0610 detections not to over-warn about explicit
|
157
|
+
controlling expressions of for-statements by adding workarounds for
|
158
|
+
the interpreter.
|
159
|
+
- Fix W0088 detection not to warn about controlling expression of
|
160
|
+
for-statement.
|
161
|
+
- Fix W0723 detection in order to correctly warn about signed `-'
|
162
|
+
expression.
|
163
|
+
- Fix bad parameter type convertibility check and bad type
|
164
|
+
convertibility check of pointer to arbitrary types to void-pointer.
|
165
|
+
- Revise string representation of typedefed type so that message and
|
166
|
+
metric show typedefed type name itself.
|
167
|
+
|
168
|
+
Wed Oct 17 18:08:20 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
169
|
+
|
170
|
+
* lib/adlint/c/type.rb : Revise string representation of typedefed type
|
171
|
+
so that message and metric show typedefed type name itself.
|
172
|
+
|
173
|
+
Wed Oct 17 14:48:23 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
174
|
+
|
175
|
+
* features/code_check/W9003.feature : Add W9003 specification to
|
176
|
+
reproduce a known bug.
|
177
|
+
|
178
|
+
* lib/adlint/c/type.rb : Fix bad parameter type convertibility check
|
179
|
+
and bad type convertibility check of pointer to arbitrary types to
|
180
|
+
void-pointer.
|
181
|
+
|
182
|
+
Wed Oct 17 13:30:01 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
183
|
+
|
184
|
+
* features/code_check/W0722.feature : Add W0722 specification.
|
185
|
+
* MANIFEST : Ditto.
|
186
|
+
|
187
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0723 detection in order
|
188
|
+
to correctly warn about signed `-' expression.
|
189
|
+
|
190
|
+
Tue Oct 16 18:44:33 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
191
|
+
|
192
|
+
* features/code_check/W0088.feature : Add W0088 specification.
|
193
|
+
* MANIFEST : Ditto.
|
194
|
+
|
195
|
+
* lib/adlint/c/interp.rb : Add notification about expression-statement
|
196
|
+
evaluation.
|
197
|
+
* lib/adlint/c/mediator.rb : Ditto.
|
198
|
+
|
199
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0088 detection not to
|
200
|
+
warn about controlling expression of a for-statement.
|
201
|
+
|
202
|
+
Tue Oct 16 16:39:52 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
203
|
+
|
204
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0609 and w0610 detections
|
205
|
+
not to over-warn about explicit controlling expressions of
|
206
|
+
for-statements by adding workarounds for the abstract interpreter.
|
207
|
+
* lib/adlint/c/syntax.rb : Ditto.
|
208
|
+
* lib/adlint/c/interp.rb : Ditto.
|
209
|
+
|
1
210
|
Mon Oct 15 13:27:34 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
211
|
|
3
212
|
* release.ga : 2.4.10
|
data/MANIFEST
CHANGED
@@ -45,6 +45,7 @@ features/code_check/W0025.feature
|
|
45
45
|
features/code_check/W0026.feature
|
46
46
|
features/code_check/W0070.feature
|
47
47
|
features/code_check/W0071.feature
|
48
|
+
features/code_check/W0088.feature
|
48
49
|
features/code_check/W0093.feature
|
49
50
|
features/code_check/W0104.feature
|
50
51
|
features/code_check/W0109.feature
|
@@ -206,7 +207,9 @@ features/code_check/W0500.feature
|
|
206
207
|
features/code_check/W0501.feature
|
207
208
|
features/code_check/W0502.feature
|
208
209
|
features/code_check/W0573.feature
|
210
|
+
features/code_check/W0582.feature
|
209
211
|
features/code_check/W0583.feature
|
212
|
+
features/code_check/W0584.feature
|
210
213
|
features/code_check/W0606.feature
|
211
214
|
features/code_check/W0635.feature
|
212
215
|
features/code_check/W0641.feature
|
@@ -243,6 +246,7 @@ features/code_check/W0716.feature
|
|
243
246
|
features/code_check/W0717.feature
|
244
247
|
features/code_check/W0718.feature
|
245
248
|
features/code_check/W0719.feature
|
249
|
+
features/code_check/W0722.feature
|
246
250
|
features/code_check/W0723.feature
|
247
251
|
features/code_check/W0726.feature
|
248
252
|
features/code_check/W0732.feature
|
data/NEWS
CHANGED
@@ -21,6 +21,25 @@
|
|
21
21
|
|
22
22
|
++
|
23
23
|
|
24
|
+
=== \AdLint 2.6.0 is released (2012-10-22)
|
25
|
+
|
26
|
+
==== Changes since the 2.4.10 release
|
27
|
+
|
28
|
+
* Fix W0609 and w0610 detections not to over-warn about explicit controlling
|
29
|
+
expressions of for-statements by adding workarounds for the interpreter
|
30
|
+
* Fix W0088 detection not to warn about controlling expression of for-statement
|
31
|
+
* Fix W0723 detection in order to correctly warn about signed `-' expression
|
32
|
+
* Fix bad parameter type convertibility check and bad type convertibility check
|
33
|
+
of pointer to arbitrary types to void-pointer
|
34
|
+
* Revise string representation of typedefed type so that message and metric
|
35
|
+
show typedefed type name itself
|
36
|
+
* Clarify W9003 message text by adding destination type name of the implicit
|
37
|
+
conversion
|
38
|
+
|
39
|
+
See the file
|
40
|
+
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
41
|
+
for more details.
|
42
|
+
|
24
43
|
=== \AdLint 2.4.10 is released (2012-10-15)
|
25
44
|
|
26
45
|
==== Changes since the 2.4.6 release
|
@@ -35,10 +54,6 @@
|
|
35
54
|
* Fix W0488, W0489, W0490, W0495, W0496, W0497, W0498, W0499, W0500, W0501 and
|
36
55
|
W0502 detections to warn when a problematic expression is grouped entirely
|
37
56
|
|
38
|
-
See the file
|
39
|
-
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
40
|
-
for more details.
|
41
|
-
|
42
57
|
=== \AdLint 2.4.6 is released (2012-10-09)
|
43
58
|
|
44
59
|
==== Changes since the 2.4.0 release
|
@@ -49,7 +49,7 @@
|
|
49
49
|
# - "ERR:X99"
|
50
50
|
# format: "Your custom message for the error of E9999."
|
51
51
|
|
52
|
-
version: "2.
|
52
|
+
version: "2.6.0"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -2991,7 +2991,7 @@ message_definition:
|
|
2991
2991
|
W9003:
|
2992
2992
|
classes:
|
2993
2993
|
- "UNC:X99"
|
2994
|
-
format: "An object typed `%s' is implicitly converted into an object of
|
2994
|
+
format: "An object typed `%s' is implicitly converted into an object of type `%s'."
|
2995
2995
|
C0001:
|
2996
2996
|
classes:
|
2997
2997
|
- "INF:X99"
|
@@ -49,7 +49,7 @@
|
|
49
49
|
# - "ERR:X99"
|
50
50
|
# format: "Your custom message for the error of E9999."
|
51
51
|
|
52
|
-
version: "2.
|
52
|
+
version: "2.6.0"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -2991,7 +2991,7 @@ message_definition:
|
|
2991
2991
|
W9003:
|
2992
2992
|
classes:
|
2993
2993
|
- "UNC:X99"
|
2994
|
-
format: "暗黙的に `%s'
|
2994
|
+
format: "暗黙的に `%s' 型のオブジェクトが `%s' 型のオブジェクトに変換されています。"
|
2995
2995
|
C0001:
|
2996
2996
|
classes:
|
2997
2997
|
- "INF:X99"
|
@@ -0,0 +1,153 @@
|
|
1
|
+
Feature: W0088
|
2
|
+
|
3
|
+
W0088 detects that right-hand-side of the logical-expression in a standalone
|
4
|
+
expression-statement has no side-effect.
|
5
|
+
|
6
|
+
Scenario: no side-effect in a standalone expression-statement
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
static int foo(int n)
|
10
|
+
{
|
11
|
+
int i = bar();
|
12
|
+
(i < n) && (i < 10); /* W0088 */
|
13
|
+
return i;
|
14
|
+
}
|
15
|
+
"""
|
16
|
+
When I successfully run `adlint fixture.c` on noarch
|
17
|
+
Then the output should exactly match with:
|
18
|
+
| mesg | line | column |
|
19
|
+
| W1076 | 1 | 12 |
|
20
|
+
| W0109 | 3 | 16 |
|
21
|
+
| W0088 | 4 | 13 |
|
22
|
+
| W0100 | 3 | 9 |
|
23
|
+
| W0104 | 1 | 20 |
|
24
|
+
| W0629 | 1 | 12 |
|
25
|
+
| W0085 | 4 | 5 |
|
26
|
+
| W0628 | 1 | 12 |
|
27
|
+
|
28
|
+
Scenario: side-effect in a standalone expression-statement
|
29
|
+
Given a target source named "fixture.c" with:
|
30
|
+
"""
|
31
|
+
static int foo(int n)
|
32
|
+
{
|
33
|
+
int i = bar();
|
34
|
+
(i < n) && (i++); /* OK */
|
35
|
+
return i;
|
36
|
+
}
|
37
|
+
"""
|
38
|
+
When I successfully run `adlint fixture.c` on noarch
|
39
|
+
Then the output should exactly match with:
|
40
|
+
| mesg | line | column |
|
41
|
+
| W1076 | 1 | 12 |
|
42
|
+
| W0109 | 3 | 16 |
|
43
|
+
| W0104 | 1 | 20 |
|
44
|
+
| W0629 | 1 | 12 |
|
45
|
+
| W0508 | 4 | 13 |
|
46
|
+
| W0735 | 4 | 16 |
|
47
|
+
| W0512 | 4 | 18 |
|
48
|
+
| W0628 | 1 | 12 |
|
49
|
+
|
50
|
+
Scenario: no side-effect in controlling expression of for-statement
|
51
|
+
Given a target source named "fixture.c" with:
|
52
|
+
"""
|
53
|
+
static int foo(int n)
|
54
|
+
{
|
55
|
+
int i, j = 0;
|
56
|
+
for (i = 0; (i < n) && (i < 10); i++) { /* OK */
|
57
|
+
j++;
|
58
|
+
}
|
59
|
+
return j;
|
60
|
+
}
|
61
|
+
"""
|
62
|
+
When I successfully run `adlint fixture.c` on noarch
|
63
|
+
Then the output should exactly match with:
|
64
|
+
| mesg | line | column |
|
65
|
+
| W1076 | 1 | 12 |
|
66
|
+
| W0104 | 1 | 20 |
|
67
|
+
| W0629 | 1 | 12 |
|
68
|
+
| W0425 | 3 | 12 |
|
69
|
+
| W0628 | 1 | 12 |
|
70
|
+
|
71
|
+
Scenario: no side-effect in right-most expression of a standalone
|
72
|
+
expression-statement
|
73
|
+
Given a target source named "fixture.c" with:
|
74
|
+
"""
|
75
|
+
extern int foo(int);
|
76
|
+
extern int bar(int);
|
77
|
+
|
78
|
+
static void baz(int i, int j, int k)
|
79
|
+
{
|
80
|
+
(i > 0) && foo(i) && bar(j) && k; /* W0088 */
|
81
|
+
}
|
82
|
+
"""
|
83
|
+
When I successfully run `adlint fixture.c` on noarch
|
84
|
+
Then the output should exactly match with:
|
85
|
+
| mesg | line | column |
|
86
|
+
| W0118 | 1 | 12 |
|
87
|
+
| W0118 | 2 | 12 |
|
88
|
+
| W1076 | 4 | 13 |
|
89
|
+
| W0088 | 6 | 33 |
|
90
|
+
| W0104 | 4 | 21 |
|
91
|
+
| W0104 | 4 | 28 |
|
92
|
+
| W0104 | 4 | 35 |
|
93
|
+
| W0629 | 4 | 13 |
|
94
|
+
| W0488 | 6 | 5 |
|
95
|
+
| W0508 | 6 | 23 |
|
96
|
+
| W0508 | 6 | 13 |
|
97
|
+
| W0628 | 4 | 13 |
|
98
|
+
|
99
|
+
Scenario: no side-effect in right-most expression of an assignment-expression
|
100
|
+
Given a target source named "fixture.c" with:
|
101
|
+
"""
|
102
|
+
extern int foo(int);
|
103
|
+
extern int bar(int);
|
104
|
+
|
105
|
+
static void baz(int i, int j, int k)
|
106
|
+
{
|
107
|
+
int l = 0;
|
108
|
+
l = (i > 0) && foo(i) && bar(j) && k; /* OK */
|
109
|
+
}
|
110
|
+
"""
|
111
|
+
When I successfully run `adlint fixture.c` on noarch
|
112
|
+
Then the output should exactly match with:
|
113
|
+
| mesg | line | column |
|
114
|
+
| W0118 | 1 | 12 |
|
115
|
+
| W0118 | 2 | 12 |
|
116
|
+
| W1076 | 4 | 13 |
|
117
|
+
| W0104 | 4 | 21 |
|
118
|
+
| W0104 | 4 | 28 |
|
119
|
+
| W0104 | 4 | 35 |
|
120
|
+
| W0629 | 4 | 13 |
|
121
|
+
| W0488 | 7 | 5 |
|
122
|
+
| W0508 | 7 | 27 |
|
123
|
+
| W0508 | 7 | 17 |
|
124
|
+
| W0628 | 4 | 13 |
|
125
|
+
|
126
|
+
Scenario: no side-effect in argument expressions of function-call-expression
|
127
|
+
Given a target source named "fixture.c" with:
|
128
|
+
"""
|
129
|
+
extern int foo(int);
|
130
|
+
extern int bar(int);
|
131
|
+
extern void baz(const char *, ...);
|
132
|
+
|
133
|
+
static void qux(int i, int j, int k)
|
134
|
+
{
|
135
|
+
baz("", (i > 0) && foo(i) && bar(i || j) && k); /* OK */
|
136
|
+
}
|
137
|
+
"""
|
138
|
+
When I successfully run `adlint fixture.c` on noarch
|
139
|
+
Then the output should exactly match with:
|
140
|
+
| mesg | line | column |
|
141
|
+
| W0118 | 1 | 12 |
|
142
|
+
| W0118 | 2 | 12 |
|
143
|
+
| W0118 | 3 | 13 |
|
144
|
+
| W1076 | 5 | 13 |
|
145
|
+
| W0104 | 5 | 21 |
|
146
|
+
| W0104 | 5 | 28 |
|
147
|
+
| W0104 | 5 | 35 |
|
148
|
+
| W0629 | 5 | 13 |
|
149
|
+
| W0488 | 7 | 13 |
|
150
|
+
| W0947 | 7 | 9 |
|
151
|
+
| W0508 | 7 | 31 |
|
152
|
+
| W0508 | 7 | 21 |
|
153
|
+
| W0628 | 5 | 13 |
|