adlint 1.16.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +471 -0
- data/MANIFEST +35 -8
- data/NEWS +50 -4
- data/bin/adlint +7 -7
- data/bin/adlint_chk +7 -7
- data/bin/adlint_cma +7 -7
- data/bin/adlint_sma +7 -7
- data/bin/adlintize +5 -5
- data/etc/mesg.d/en_US/messages.yml +3 -3
- data/etc/mesg.d/ja_JP/messages.yml +3 -3
- data/features/message_detection/E0013.feature +34 -0
- data/features/message_detection/W0007.feature +2 -0
- data/features/message_detection/W0583.feature +1 -2
- data/features/message_detection/W0641.feature +132 -0
- data/features/message_detection/W0643.feature +1 -1
- data/features/message_detection/W0644.feature +529 -0
- data/features/message_detection/W0645.feature +1 -1
- data/features/message_detection/W0649.feature +277 -0
- data/features/message_detection/W0650.feature +208 -0
- data/features/message_detection/W0697.feature +6 -0
- data/features/message_detection/W0705.feature +350 -0
- data/features/message_detection/W0707.feature +223 -0
- data/features/message_detection/W0711.feature +113 -0
- data/features/message_detection/W0712.feature +113 -0
- data/features/message_detection/W0713.feature +110 -0
- data/features/message_detection/W0714.feature +118 -0
- data/features/message_detection/W0715.feature +118 -0
- data/features/message_detection/W0716.feature +1 -0
- data/features/message_detection/W0717.feature +1 -0
- data/features/message_detection/W0718.feature +1 -0
- data/features/message_detection/W0719.feature +154 -0
- data/features/message_detection/W0723.feature +1 -2
- data/features/message_detection/W0732.feature +3 -0
- data/features/message_detection/W0733.feature +3 -0
- data/features/message_detection/W0734.feature +4 -0
- data/features/message_detection/W0735.feature +4 -0
- data/features/message_detection/W0745.feature +132 -0
- data/features/message_detection/W0780.feature +68 -0
- data/features/message_detection/W0783.feature +95 -0
- data/features/message_detection/W0792.feature +124 -0
- data/features/message_detection/W0793.feature +153 -0
- data/features/message_detection/W0794.feature +90 -0
- data/features/message_detection/W0830.feature +65 -0
- data/features/message_detection/W0833.feature +220 -0
- data/features/message_detection/W0834.feature +189 -0
- data/features/message_detection/W1026.feature +105 -0
- data/features/message_detection/W1031.feature +17 -34
- data/features/message_detection/W1039.feature +268 -0
- data/features/message_detection/W1047.feature +163 -0
- data/features/message_detection/W1066.feature +1 -0
- data/features/message_detection/W1067.feature +1 -0
- data/features/message_detection/W1068.feature +1 -0
- data/features/message_detection/W1069.feature +5 -0
- data/features/message_detection/W1070.feature +5 -0
- data/features/message_detection/W1071.feature +83 -0
- data/features/message_detection/W1073.feature +3 -2
- data/features/message_detection/W9003.feature +7 -12
- data/features/step_definitions/message_detection_steps.rb +4 -31
- data/features/support/env.rb +117 -2
- data/lib/adlint/c/branch.rb +0 -2
- data/lib/adlint/c/ctrlexpr.rb +33 -0
- data/lib/adlint/c/expr.rb +119 -31
- data/lib/adlint/c/interp.rb +44 -3
- data/lib/adlint/c/message.rb +1411 -29
- data/lib/adlint/c/object.rb +16 -2
- data/lib/adlint/c/option.rb +1 -0
- data/lib/adlint/c/parser.rb +101 -100
- data/lib/adlint/c/parser.y +3 -2
- data/lib/adlint/c/phase.rb +18 -0
- data/lib/adlint/c/resolver.rb +23 -0
- data/lib/adlint/c/syntax.rb +90 -4
- data/lib/adlint/c/type.rb +177 -110
- data/lib/adlint/cpp/macro.rb +4 -4
- data/lib/adlint/version.rb +2 -2
- data/share/demo/bad_include/test/"1/".h +0 -0
- 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 +467 -506
- data/share/doc/users_guide_en.texi +95 -125
- data/share/doc/users_guide_ja.html +471 -518
- data/share/doc/users_guide_ja.texi +95 -133
- data/spec/spec_helper.rb +6 -0
- metadata +37 -10
@@ -0,0 +1,105 @@
|
|
1
|
+
Feature: W1026
|
2
|
+
|
3
|
+
W1026 detects that type of an argument is incomplete.
|
4
|
+
|
5
|
+
Scenario: incomplete struct type as an argument
|
6
|
+
Given a target source named "W1026.c" with:
|
7
|
+
"""
|
8
|
+
extern struct st s;
|
9
|
+
extern void foo(struct st);
|
10
|
+
|
11
|
+
void bar(void)
|
12
|
+
{
|
13
|
+
foo(s); /* W1026 */
|
14
|
+
}
|
15
|
+
"""
|
16
|
+
When I successfully run `adlint W1026.c` on noarch
|
17
|
+
Then the output should exactly match with:
|
18
|
+
| mesg | line | column |
|
19
|
+
| W0118 | 1 | 18 |
|
20
|
+
| W0118 | 2 | 13 |
|
21
|
+
| W0117 | 4 | 6 |
|
22
|
+
| W0493 | 6 | 8 |
|
23
|
+
| W1026 | 6 | 9 |
|
24
|
+
| W0628 | 4 | 6 |
|
25
|
+
|
26
|
+
Scenario: incomplete typedef-ed struct type as an argument
|
27
|
+
Given a target source named "W1026.c" with:
|
28
|
+
"""
|
29
|
+
typedef struct st st_t;
|
30
|
+
|
31
|
+
extern st_t s;
|
32
|
+
extern void foo(st_t);
|
33
|
+
|
34
|
+
void bar(void)
|
35
|
+
{
|
36
|
+
foo(s); /* W1026 */
|
37
|
+
}
|
38
|
+
"""
|
39
|
+
When I successfully run `adlint W1026.c` on noarch
|
40
|
+
Then the output should exactly match with:
|
41
|
+
| mesg | line | column |
|
42
|
+
| W0118 | 3 | 13 |
|
43
|
+
| W0625 | 1 | 19 |
|
44
|
+
| W0118 | 4 | 13 |
|
45
|
+
| W0117 | 6 | 6 |
|
46
|
+
| W0493 | 8 | 8 |
|
47
|
+
| W1026 | 8 | 9 |
|
48
|
+
| W0628 | 6 | 6 |
|
49
|
+
|
50
|
+
Scenario: complete struct type as an argument
|
51
|
+
Given a target source named "W1026.c" with:
|
52
|
+
"""
|
53
|
+
typedef struct {
|
54
|
+
int i;
|
55
|
+
} st_t;
|
56
|
+
|
57
|
+
extern st_t s;
|
58
|
+
extern void foo(st_t);
|
59
|
+
|
60
|
+
void bar(void)
|
61
|
+
{
|
62
|
+
foo(s); /* OK */
|
63
|
+
}
|
64
|
+
"""
|
65
|
+
When I successfully run `adlint W1026.c` on noarch
|
66
|
+
Then the output should exactly match with:
|
67
|
+
| mesg | line | column |
|
68
|
+
| W0118 | 5 | 13 |
|
69
|
+
| W0625 | 3 | 3 |
|
70
|
+
| W0118 | 6 | 13 |
|
71
|
+
| W0117 | 8 | 6 |
|
72
|
+
| W0493 | 10 | 8 |
|
73
|
+
| W0628 | 8 | 6 |
|
74
|
+
|
75
|
+
Scenario: multiple incomplete typed arguments
|
76
|
+
Given a target source named "W1026.c" with:
|
77
|
+
"""
|
78
|
+
typedef struct st st_t;
|
79
|
+
typedef enum en en_t;
|
80
|
+
|
81
|
+
extern st_t s;
|
82
|
+
extern en_t e;
|
83
|
+
extern void foo(st_t, int, en_t);
|
84
|
+
|
85
|
+
void bar(void)
|
86
|
+
{
|
87
|
+
foo(s, 0, e); /* two W1026 */
|
88
|
+
}
|
89
|
+
"""
|
90
|
+
When I successfully run `adlint W1026.c` on noarch
|
91
|
+
Then the output should exactly match with:
|
92
|
+
| mesg | line | column |
|
93
|
+
| W0118 | 4 | 13 |
|
94
|
+
| W0625 | 1 | 19 |
|
95
|
+
| W0118 | 5 | 13 |
|
96
|
+
| W0625 | 2 | 17 |
|
97
|
+
| W0737 | 5 | 13 |
|
98
|
+
| W0118 | 6 | 13 |
|
99
|
+
| W0117 | 8 | 6 |
|
100
|
+
| W0493 | 10 | 8 |
|
101
|
+
| W1026 | 10 | 9 |
|
102
|
+
| W1026 | 10 | 15 |
|
103
|
+
| W0628 | 8 | 6 |
|
104
|
+
|
105
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -14,8 +14,7 @@ Feature: W1031
|
|
14
14
|
}
|
15
15
|
"""
|
16
16
|
When I successfully run `adlint W1031.c` on noarch
|
17
|
-
Then the output should
|
18
|
-
And the output should exactly match with:
|
17
|
+
Then the output should exactly match with:
|
19
18
|
| mesg | line | column |
|
20
19
|
| W1075 | 3 | 5 |
|
21
20
|
| W0104 | 3 | 14 |
|
@@ -33,8 +32,7 @@ Feature: W1031
|
|
33
32
|
}
|
34
33
|
"""
|
35
34
|
When I successfully run `adlint W1031.c` on noarch
|
36
|
-
Then the output should
|
37
|
-
And the output should exactly match with:
|
35
|
+
Then the output should exactly match with:
|
38
36
|
| mesg | line | column |
|
39
37
|
| W0118 | 1 | 12 |
|
40
38
|
| W0104 | 3 | 14 |
|
@@ -51,8 +49,7 @@ Feature: W1031
|
|
51
49
|
}
|
52
50
|
"""
|
53
51
|
When I successfully run `adlint W1031.c` on noarch
|
54
|
-
Then the output should
|
55
|
-
And the output should exactly match with:
|
52
|
+
Then the output should exactly match with:
|
56
53
|
| mesg | line | column |
|
57
54
|
| W0118 | 1 | 5 |
|
58
55
|
| W0104 | 3 | 14 |
|
@@ -87,8 +84,7 @@ Feature: W1031
|
|
87
84
|
}
|
88
85
|
"""
|
89
86
|
When I successfully run `adlint W1031.c` on noarch
|
90
|
-
Then the output should
|
91
|
-
And the output should exactly match with:
|
87
|
+
Then the output should exactly match with:
|
92
88
|
| mesg | line | column |
|
93
89
|
| W0118 | 1 | 5 |
|
94
90
|
| W0104 | 3 | 21 |
|
@@ -105,8 +101,7 @@ Feature: W1031
|
|
105
101
|
}
|
106
102
|
"""
|
107
103
|
When I successfully run `adlint W1031.c` on noarch
|
108
|
-
Then the output should match with
|
109
|
-
And the output should exactly match with:
|
104
|
+
Then the output should exactly match with:
|
110
105
|
| mesg | line | column |
|
111
106
|
| W1031 | 3 | 12 |
|
112
107
|
| W1075 | 3 | 12 |
|
@@ -125,8 +120,7 @@ Feature: W1031
|
|
125
120
|
}
|
126
121
|
"""
|
127
122
|
When I successfully run `adlint W1031.c` on noarch
|
128
|
-
Then the output should match with
|
129
|
-
And the output should exactly match with:
|
123
|
+
Then the output should exactly match with:
|
130
124
|
| mesg | line | column |
|
131
125
|
| W0118 | 1 | 12 |
|
132
126
|
| W1031 | 3 | 12 |
|
@@ -141,8 +135,7 @@ Feature: W1031
|
|
141
135
|
int i = 0; /* OK */
|
142
136
|
"""
|
143
137
|
When I successfully run `adlint W1031.c` on noarch
|
144
|
-
Then the output should
|
145
|
-
And the output should exactly match with:
|
138
|
+
Then the output should exactly match with:
|
146
139
|
| mesg | line | column |
|
147
140
|
| W0118 | 1 | 12 |
|
148
141
|
|
@@ -154,8 +147,7 @@ Feature: W1031
|
|
154
147
|
extern int i; /* OK */
|
155
148
|
"""
|
156
149
|
When I successfully run `adlint W1031.c` on noarch
|
157
|
-
Then the output should
|
158
|
-
And the output should exactly match with:
|
150
|
+
Then the output should exactly match with:
|
159
151
|
| mesg | line | column |
|
160
152
|
| W0117 | 1 | 5 |
|
161
153
|
| W0118 | 2 | 12 |
|
@@ -168,8 +160,7 @@ Feature: W1031
|
|
168
160
|
extern int i = 0; /* W1031 */
|
169
161
|
"""
|
170
162
|
When I successfully run `adlint W1031.c` on noarch
|
171
|
-
Then the output should match with
|
172
|
-
And the output should exactly match with:
|
163
|
+
Then the output should exactly match with:
|
173
164
|
| mesg | line | column |
|
174
165
|
| W1031 | 2 | 12 |
|
175
166
|
| W1075 | 2 | 12 |
|
@@ -182,8 +173,7 @@ Feature: W1031
|
|
182
173
|
static int i = 0; /* W1031 */
|
183
174
|
"""
|
184
175
|
When I successfully run `adlint W1031.c` on noarch
|
185
|
-
Then the output should match with
|
186
|
-
And the output should exactly match with:
|
176
|
+
Then the output should exactly match with:
|
187
177
|
| mesg | line | column |
|
188
178
|
| W0118 | 1 | 12 |
|
189
179
|
| W1031 | 2 | 12 |
|
@@ -199,8 +189,7 @@ Feature: W1031
|
|
199
189
|
int foo(long); /* OK */
|
200
190
|
"""
|
201
191
|
When I successfully run `adlint W1031.c` on noarch
|
202
|
-
Then the output should
|
203
|
-
And the output should exactly match with:
|
192
|
+
Then the output should exactly match with:
|
204
193
|
| mesg | line | column |
|
205
194
|
| W1076 | 1 | 12 |
|
206
195
|
| W0104 | 1 | 21 |
|
@@ -220,8 +209,7 @@ Feature: W1031
|
|
220
209
|
int foo(long); /* OK */
|
221
210
|
"""
|
222
211
|
When I successfully run `adlint W1031.c` on noarch
|
223
|
-
Then the output should
|
224
|
-
And the output should exactly match with:
|
212
|
+
Then the output should exactly match with:
|
225
213
|
| mesg | line | column |
|
226
214
|
| W0117 | 1 | 12 |
|
227
215
|
| W0104 | 1 | 21 |
|
@@ -240,8 +228,7 @@ Feature: W1031
|
|
240
228
|
int foo(long); /* OK */
|
241
229
|
"""
|
242
230
|
When I successfully run `adlint W1031.c` on noarch
|
243
|
-
Then the output should
|
244
|
-
And the output should exactly match with:
|
231
|
+
Then the output should exactly match with:
|
245
232
|
| mesg | line | column |
|
246
233
|
| W0117 | 1 | 5 |
|
247
234
|
| W0104 | 1 | 14 |
|
@@ -260,8 +247,7 @@ Feature: W1031
|
|
260
247
|
static int foo(long); /* W1031 */
|
261
248
|
"""
|
262
249
|
When I successfully run `adlint W1031.c` on noarch
|
263
|
-
Then the output should match with
|
264
|
-
And the output should exactly match with:
|
250
|
+
Then the output should exactly match with:
|
265
251
|
| mesg | line | column |
|
266
252
|
| W0117 | 1 | 5 |
|
267
253
|
| W0104 | 1 | 14 |
|
@@ -281,8 +267,7 @@ Feature: W1031
|
|
281
267
|
extern int foo(long); /* OK */
|
282
268
|
"""
|
283
269
|
When I successfully run `adlint W1031.c` on noarch
|
284
|
-
Then the output should
|
285
|
-
And the output should exactly match with:
|
270
|
+
Then the output should exactly match with:
|
286
271
|
| mesg | line | column |
|
287
272
|
| W0117 | 1 | 5 |
|
288
273
|
| W0104 | 1 | 14 |
|
@@ -301,8 +286,7 @@ Feature: W1031
|
|
301
286
|
extern int foo(long l); /* W1031 */
|
302
287
|
"""
|
303
288
|
When I successfully run `adlint W1031.c` on noarch
|
304
|
-
Then the output should match with
|
305
|
-
And the output should exactly match with:
|
289
|
+
Then the output should exactly match with:
|
306
290
|
| mesg | line | column |
|
307
291
|
| W1076 | 1 | 12 |
|
308
292
|
| W0104 | 1 | 21 |
|
@@ -322,8 +306,7 @@ Feature: W1031
|
|
322
306
|
static int foo(long); /* W1031 */
|
323
307
|
"""
|
324
308
|
When I successfully run `adlint W1031.c` on noarch
|
325
|
-
Then the output should match with
|
326
|
-
And the output should exactly match with:
|
309
|
+
Then the output should exactly match with:
|
327
310
|
| mesg | line | column |
|
328
311
|
| W0117 | 1 | 12 |
|
329
312
|
| W0104 | 1 | 21 |
|
@@ -0,0 +1,268 @@
|
|
1
|
+
Feature: W1039
|
2
|
+
|
3
|
+
W1039 detects that an `ll' length-modifier is found in *printf or *scanf
|
4
|
+
function call.
|
5
|
+
|
6
|
+
Scenario: an `ll' in printf function call
|
7
|
+
Given a target source named "W1039.c" with:
|
8
|
+
"""
|
9
|
+
#include <stdio.h>
|
10
|
+
|
11
|
+
void foo(long long ll)
|
12
|
+
{
|
13
|
+
printf("%lld", ll); /* W1039 */
|
14
|
+
}
|
15
|
+
"""
|
16
|
+
When I successfully run `adlint W1039.c` on noarch
|
17
|
+
Then the output should exactly match with:
|
18
|
+
| mesg | line | column |
|
19
|
+
| W0117 | 3 | 6 |
|
20
|
+
| W1039 | 5 | 12 |
|
21
|
+
| W0104 | 3 | 20 |
|
22
|
+
| W1073 | 5 | 11 |
|
23
|
+
| W0834 | 3 | 10 |
|
24
|
+
| W0947 | 5 | 12 |
|
25
|
+
| W0628 | 3 | 6 |
|
26
|
+
|
27
|
+
Scenario: an `ll' in scanf function call
|
28
|
+
Given a target source named "W1039.c" with:
|
29
|
+
"""
|
30
|
+
#include <stdio.h>
|
31
|
+
|
32
|
+
void foo(void)
|
33
|
+
{
|
34
|
+
long long ll = 0;
|
35
|
+
scanf("%lld", &ll); /* W1039 */
|
36
|
+
}
|
37
|
+
"""
|
38
|
+
When I successfully run `adlint W1039.c` on noarch
|
39
|
+
Then the output should exactly match with:
|
40
|
+
| mesg | line | column |
|
41
|
+
| W0117 | 3 | 6 |
|
42
|
+
| W1039 | 6 | 11 |
|
43
|
+
| W1073 | 6 | 10 |
|
44
|
+
| W0834 | 5 | 5 |
|
45
|
+
| W0947 | 6 | 11 |
|
46
|
+
| W0628 | 3 | 6 |
|
47
|
+
|
48
|
+
Scenario: an `ll' with one of conversion-specifiers in printf function call
|
49
|
+
Given a target source named "W1039.c" with:
|
50
|
+
"""
|
51
|
+
#include <stdio.h>
|
52
|
+
|
53
|
+
void foo(int i, long long ll, unsigned long ul)
|
54
|
+
{
|
55
|
+
printf("%d %lld %lu", i, ll, ul); /* W1039 */
|
56
|
+
}
|
57
|
+
"""
|
58
|
+
When I successfully run `adlint W1039.c` on noarch
|
59
|
+
Then the output should exactly match with:
|
60
|
+
| mesg | line | column |
|
61
|
+
| W0117 | 3 | 6 |
|
62
|
+
| W1039 | 5 | 12 |
|
63
|
+
| W0104 | 3 | 14 |
|
64
|
+
| W0104 | 3 | 27 |
|
65
|
+
| W0104 | 3 | 45 |
|
66
|
+
| W1073 | 5 | 11 |
|
67
|
+
| W0834 | 3 | 17 |
|
68
|
+
| W0947 | 5 | 12 |
|
69
|
+
| W0628 | 3 | 6 |
|
70
|
+
|
71
|
+
Scenario: an `ll' with one of conversion-specifiers in scanf function call
|
72
|
+
Given a target source named "W1039.c" with:
|
73
|
+
"""
|
74
|
+
#include <stdio.h>
|
75
|
+
|
76
|
+
void foo(void)
|
77
|
+
{
|
78
|
+
int i = 0;
|
79
|
+
long long ll = 0;
|
80
|
+
unsigned long ul = 0U;
|
81
|
+
scanf("%d %lld %lu", &i, &ll, &ul); /* W1039 */
|
82
|
+
}
|
83
|
+
"""
|
84
|
+
When I successfully run `adlint W1039.c` on noarch
|
85
|
+
Then the output should exactly match with:
|
86
|
+
| mesg | line | column |
|
87
|
+
| W0117 | 3 | 6 |
|
88
|
+
| W1039 | 8 | 11 |
|
89
|
+
| W1073 | 8 | 10 |
|
90
|
+
| W0834 | 6 | 5 |
|
91
|
+
| W0947 | 8 | 11 |
|
92
|
+
| W0628 | 3 | 6 |
|
93
|
+
|
94
|
+
Scenario: an `ll' with conversion-specifier `i' in printf function call
|
95
|
+
Given a target source named "W1039.c" with:
|
96
|
+
"""
|
97
|
+
#include <stdio.h>
|
98
|
+
|
99
|
+
void foo(long long ll)
|
100
|
+
{
|
101
|
+
printf("%lli", ll); /* W1039 */
|
102
|
+
}
|
103
|
+
"""
|
104
|
+
When I successfully run `adlint W1039.c` on noarch
|
105
|
+
Then the output should exactly match with:
|
106
|
+
| mesg | line | column |
|
107
|
+
| W0117 | 3 | 6 |
|
108
|
+
| W1039 | 5 | 12 |
|
109
|
+
| W0104 | 3 | 20 |
|
110
|
+
| W1073 | 5 | 11 |
|
111
|
+
| W0834 | 3 | 10 |
|
112
|
+
| W0947 | 5 | 12 |
|
113
|
+
| W0628 | 3 | 6 |
|
114
|
+
|
115
|
+
Scenario: an `ll' with conversion-specifier `o' in printf function call
|
116
|
+
Given a target source named "W1039.c" with:
|
117
|
+
"""
|
118
|
+
#include <stdio.h>
|
119
|
+
|
120
|
+
void foo(unsigned long long ull)
|
121
|
+
{
|
122
|
+
printf("%llo", ull); /* W1039 */
|
123
|
+
}
|
124
|
+
"""
|
125
|
+
When I successfully run `adlint W1039.c` on noarch
|
126
|
+
Then the output should exactly match with:
|
127
|
+
| mesg | line | column |
|
128
|
+
| W0117 | 3 | 6 |
|
129
|
+
| W1039 | 5 | 12 |
|
130
|
+
| W0104 | 3 | 29 |
|
131
|
+
| W1073 | 5 | 11 |
|
132
|
+
| W0834 | 3 | 10 |
|
133
|
+
| W0947 | 5 | 12 |
|
134
|
+
| W0628 | 3 | 6 |
|
135
|
+
|
136
|
+
Scenario: an `ll' with conversion-specifier `u' in printf function call
|
137
|
+
Given a target source named "W1039.c" with:
|
138
|
+
"""
|
139
|
+
#include <stdio.h>
|
140
|
+
|
141
|
+
void foo(unsigned long long ull)
|
142
|
+
{
|
143
|
+
printf("%llu", ull); /* W1039 */
|
144
|
+
}
|
145
|
+
"""
|
146
|
+
When I successfully run `adlint W1039.c` on noarch
|
147
|
+
Then the output should exactly match with:
|
148
|
+
| mesg | line | column |
|
149
|
+
| W0117 | 3 | 6 |
|
150
|
+
| W1039 | 5 | 12 |
|
151
|
+
| W0104 | 3 | 29 |
|
152
|
+
| W1073 | 5 | 11 |
|
153
|
+
| W0834 | 3 | 10 |
|
154
|
+
| W0947 | 5 | 12 |
|
155
|
+
| W0628 | 3 | 6 |
|
156
|
+
|
157
|
+
Scenario: an `ll' with conversion-specifier `x' in printf function call
|
158
|
+
Given a target source named "W1039.c" with:
|
159
|
+
"""
|
160
|
+
#include <stdio.h>
|
161
|
+
|
162
|
+
void foo(unsigned long long ull)
|
163
|
+
{
|
164
|
+
printf("%llx", ull); /* W1039 */
|
165
|
+
}
|
166
|
+
"""
|
167
|
+
When I successfully run `adlint W1039.c` on noarch
|
168
|
+
Then the output should exactly match with:
|
169
|
+
| mesg | line | column |
|
170
|
+
| W0117 | 3 | 6 |
|
171
|
+
| W1039 | 5 | 12 |
|
172
|
+
| W0104 | 3 | 29 |
|
173
|
+
| W1073 | 5 | 11 |
|
174
|
+
| W0834 | 3 | 10 |
|
175
|
+
| W0947 | 5 | 12 |
|
176
|
+
| W0628 | 3 | 6 |
|
177
|
+
|
178
|
+
Scenario: an `ll' with conversion-specifier `X' in printf function call
|
179
|
+
Given a target source named "W1039.c" with:
|
180
|
+
"""
|
181
|
+
#include <stdio.h>
|
182
|
+
|
183
|
+
void foo(unsigned long long ull)
|
184
|
+
{
|
185
|
+
printf("%llX", ull); /* W1039 */
|
186
|
+
}
|
187
|
+
"""
|
188
|
+
When I successfully run `adlint W1039.c` on noarch
|
189
|
+
Then the output should exactly match with:
|
190
|
+
| mesg | line | column |
|
191
|
+
| W0117 | 3 | 6 |
|
192
|
+
| W1039 | 5 | 12 |
|
193
|
+
| W0104 | 3 | 29 |
|
194
|
+
| W1073 | 5 | 11 |
|
195
|
+
| W0834 | 3 | 10 |
|
196
|
+
| W0947 | 5 | 12 |
|
197
|
+
| W0628 | 3 | 6 |
|
198
|
+
|
199
|
+
Scenario: an `ll' with conversion-specifier `d' in fprintf function call
|
200
|
+
Given a target source named "W1039.c" with:
|
201
|
+
"""
|
202
|
+
#include <stdio.h>
|
203
|
+
|
204
|
+
void foo(long long ll)
|
205
|
+
{
|
206
|
+
fprintf(stdout, "%lld", ll); /* W1039 */
|
207
|
+
}
|
208
|
+
"""
|
209
|
+
When I successfully run `adlint W1039.c` on noarch
|
210
|
+
Then the output should exactly match with:
|
211
|
+
| mesg | line | column |
|
212
|
+
| W0117 | 3 | 6 |
|
213
|
+
| W1039 | 5 | 21 |
|
214
|
+
| W0104 | 3 | 20 |
|
215
|
+
| W1073 | 5 | 12 |
|
216
|
+
| W0834 | 3 | 10 |
|
217
|
+
| W0947 | 5 | 21 |
|
218
|
+
| W0628 | 3 | 6 |
|
219
|
+
|
220
|
+
Scenario: multiple `ll' in printf function call
|
221
|
+
Given a target source named "W1039.c" with:
|
222
|
+
"""
|
223
|
+
#include <stdio.h>
|
224
|
+
|
225
|
+
void foo(long long ll, unsigned long long ull)
|
226
|
+
{
|
227
|
+
printf("%lld %llu", ll, ull); /* W1039 */
|
228
|
+
}
|
229
|
+
"""
|
230
|
+
When I successfully run `adlint W1039.c` on noarch
|
231
|
+
Then the output should exactly match with:
|
232
|
+
| mesg | line | column |
|
233
|
+
| W0117 | 3 | 6 |
|
234
|
+
| W1039 | 5 | 12 |
|
235
|
+
| W1039 | 5 | 12 |
|
236
|
+
| W0104 | 3 | 20 |
|
237
|
+
| W0104 | 3 | 43 |
|
238
|
+
| W1073 | 5 | 11 |
|
239
|
+
| W0834 | 3 | 10 |
|
240
|
+
| W0834 | 3 | 24 |
|
241
|
+
| W0947 | 5 | 12 |
|
242
|
+
| W0628 | 3 | 6 |
|
243
|
+
|
244
|
+
Scenario: multiple `ll' in scanf function call
|
245
|
+
Given a target source named "W1039.c" with:
|
246
|
+
"""
|
247
|
+
#include <stdio.h>
|
248
|
+
|
249
|
+
void foo(void)
|
250
|
+
{
|
251
|
+
long long ll = 0;
|
252
|
+
unsigned long long ull = 0U;
|
253
|
+
scanf("%lld %llu", &ll, &ull); /* W1039 */
|
254
|
+
}
|
255
|
+
"""
|
256
|
+
When I successfully run `adlint W1039.c` on noarch
|
257
|
+
Then the output should exactly match with:
|
258
|
+
| mesg | line | column |
|
259
|
+
| W0117 | 3 | 6 |
|
260
|
+
| W1039 | 7 | 11 |
|
261
|
+
| W1039 | 7 | 11 |
|
262
|
+
| W1073 | 7 | 10 |
|
263
|
+
| W0834 | 5 | 5 |
|
264
|
+
| W0834 | 6 | 5 |
|
265
|
+
| W0947 | 7 | 11 |
|
266
|
+
| W0628 | 3 | 6 |
|
267
|
+
|
268
|
+
# vim:ts=2:sw=2:sts=2:et:
|