adlint 2.0.10 → 2.2.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 +60 -0
- data/MANIFEST +3 -0
- data/NEWS +15 -4
- data/etc/mesg.d/c_builtin/en_US/messages.yml +3 -3
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +3 -3
- 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/W0431.feature +41 -0
- data/features/code_check/W0432.feature +41 -0
- data/features/code_check/W0787.feature +61 -0
- data/lib/adlint/c/ctrlexpr.rb +1 -1
- data/lib/adlint/cpp/macro.rb +4 -4
- data/lib/adlint/exam/c_builtin/c_check.rb +29 -19
- data/lib/adlint/exam/c_builtin/cpp_check.rb +4 -4
- data/lib/adlint/prelude.rb +2 -2
- 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 +9 -9
- data/share/doc/users_guide_en.texi +8 -7
- data/share/doc/users_guide_ja.html +9 -9
- data/share/doc/users_guide_ja.texi +7 -7
- metadata +5 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,63 @@
|
|
1
|
+
Wed Sep 12 10:59:42 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
|
+
|
3
|
+
* release.ga : 2.2.0
|
4
|
+
- Fix W0431 and W0432 detections not to warn about displaced
|
5
|
+
beginning of the line tokens following upon a function-like macro
|
6
|
+
call.
|
7
|
+
- Fix W0787 detection not to warn about a definition of the local
|
8
|
+
variable with type which is different from one of previously
|
9
|
+
defined variable in the other scope.
|
10
|
+
- Clarify W0025 and W0026 message texts.
|
11
|
+
|
12
|
+
Tue Sep 11 16:00:48 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
13
|
+
|
14
|
+
* release.rc : 2.1.2
|
15
|
+
- Clarify W0025 and W0026 message texts.
|
16
|
+
|
17
|
+
Tue Sep 11 15:51:13 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
18
|
+
|
19
|
+
* lib/adlint/exam/c_builtin/cpp_check.rb : Clarify W0025 and W0026
|
20
|
+
message texts.
|
21
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
22
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
23
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
24
|
+
* share/doc/users_guide_en.texi : Ditto.
|
25
|
+
|
26
|
+
Tue Sep 11 15:09:15 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
27
|
+
|
28
|
+
* release.rc : 2.1.1
|
29
|
+
- Fix W0787 detection not to warn about a definition of the local
|
30
|
+
variable with type which is different from one of previously
|
31
|
+
defined variable in the other scope.
|
32
|
+
|
33
|
+
Tue Sep 11 14:32:17 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
34
|
+
|
35
|
+
* features/code_check/W0787.feature : Add W0787 specification.
|
36
|
+
* MANIFEST : Ditto.
|
37
|
+
|
38
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0787 detection not to
|
39
|
+
warn about a definition of the local variable with type which is
|
40
|
+
different from one of previously defined variable in the other scope.
|
41
|
+
|
42
|
+
Tue Sep 11 13:03:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
43
|
+
|
44
|
+
* release.rc : 2.1.0
|
45
|
+
- Fix W0431 and W0432 detections not to warn about displaced
|
46
|
+
beginning of the line tokens following upon a function-like macro
|
47
|
+
call.
|
48
|
+
|
49
|
+
Tue Sep 11 11:26:05 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
50
|
+
|
51
|
+
* features/code_check/W0431.feature : Add W0431 specification.
|
52
|
+
* features/code_check/W0432.feature : Add W0432 specification.
|
53
|
+
* MANIFEST : Add W0431 and W0432 specifications.
|
54
|
+
|
55
|
+
* lib/adlint/cpp/macro.rb : Fix function-like macro replacement in
|
56
|
+
order to correctly locate substituted argument tokens.
|
57
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Fix W0431 and W0432 detections
|
58
|
+
not to warn about displaced beginning of the line tokens following
|
59
|
+
upon a function-like macro call.
|
60
|
+
|
1
61
|
Thu Sep 6 15:54:41 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
62
|
|
3
63
|
* release.ga : 2.0.10
|
data/MANIFEST
CHANGED
@@ -182,6 +182,8 @@ features/code_check/W0251.feature
|
|
182
182
|
features/code_check/W0252.feature
|
183
183
|
features/code_check/W0253.feature
|
184
184
|
features/code_check/W0254.feature
|
185
|
+
features/code_check/W0431.feature
|
186
|
+
features/code_check/W0432.feature
|
185
187
|
features/code_check/W0477.feature
|
186
188
|
features/code_check/W0478.feature
|
187
189
|
features/code_check/W0479.feature
|
@@ -258,6 +260,7 @@ features/code_check/W0769.feature
|
|
258
260
|
features/code_check/W0780.feature
|
259
261
|
features/code_check/W0781.feature
|
260
262
|
features/code_check/W0783.feature
|
263
|
+
features/code_check/W0787.feature
|
261
264
|
features/code_check/W0792.feature
|
262
265
|
features/code_check/W0793.feature
|
263
266
|
features/code_check/W0794.feature
|
data/NEWS
CHANGED
@@ -21,6 +21,21 @@
|
|
21
21
|
|
22
22
|
++
|
23
23
|
|
24
|
+
=== \AdLint 2.2.0 is released (2012-09-12)
|
25
|
+
|
26
|
+
==== Changes since the 2.0.10 release
|
27
|
+
|
28
|
+
* Fix W0431 and W0432 detections not to warn about displaced beginning of the
|
29
|
+
line tokens following upon a function-like macro call
|
30
|
+
* Fix W0787 detection not to warn about a definition of the local variable with
|
31
|
+
type which is different from one of previously defined variable in the other
|
32
|
+
scope
|
33
|
+
* Clarify W0025 and W0026 message texts
|
34
|
+
|
35
|
+
See the file
|
36
|
+
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
37
|
+
for more details.
|
38
|
+
|
24
39
|
=== \AdLint 2.0.10 is released (2012-09-06)
|
25
40
|
|
26
41
|
==== Changes since the 2.0.6 release
|
@@ -29,10 +44,6 @@
|
|
29
44
|
controlling variables in complexly compounded controlling expression
|
30
45
|
* Support environment variable substitution in the traits file
|
31
46
|
|
32
|
-
See the file
|
33
|
-
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
34
|
-
for more details.
|
35
|
-
|
36
47
|
=== \AdLint 2.0.6 is released (2012-08-30)
|
37
48
|
|
38
49
|
==== Changes since the 2.0.2 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.0
|
52
|
+
version: "2.2.0"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -107,11 +107,11 @@ message_definition:
|
|
107
107
|
W0025:
|
108
108
|
classes:
|
109
109
|
- "UNC:X99"
|
110
|
-
format: "
|
110
|
+
format: "`%s' is already included by this file directly."
|
111
111
|
W0026:
|
112
112
|
classes:
|
113
113
|
- "UNC:X99"
|
114
|
-
format: "
|
114
|
+
format: "`%s' is already included by this file indirectly."
|
115
115
|
W0027:
|
116
116
|
classes:
|
117
117
|
- "UNC: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.0
|
52
|
+
version: "2.2.0"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -107,11 +107,11 @@ message_definition:
|
|
107
107
|
W0025:
|
108
108
|
classes:
|
109
109
|
- "UNC:X99"
|
110
|
-
format: "
|
110
|
+
format: "`%s' は、既にこのファイルから直接インクルードされています。"
|
111
111
|
W0026:
|
112
112
|
classes:
|
113
113
|
- "UNC:X99"
|
114
|
-
format: "
|
114
|
+
format: "`%s' は、既にこのファイルから間接的にインクルードされています。"
|
115
115
|
W0027:
|
116
116
|
classes:
|
117
117
|
- "UNC:X99"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: W0431
|
2
|
+
|
3
|
+
W0431 detects that start of this line is more indented than previous lines of
|
4
|
+
the same indentation level.
|
5
|
+
|
6
|
+
Scenario: function-like macro replacement
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
extern int foo(int, int);
|
10
|
+
|
11
|
+
#define bar(a, b) ((a) > 0) ? (a) : (b)
|
12
|
+
#define baz(a, b) \
|
13
|
+
((a) > 0) ? \
|
14
|
+
(a) : (b)
|
15
|
+
|
16
|
+
void qux(void)
|
17
|
+
{
|
18
|
+
int i = 0;
|
19
|
+
|
20
|
+
i = foo(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
21
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
22
|
+
i = bar(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
23
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
24
|
+
i = baz(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
25
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
26
|
+
}
|
27
|
+
"""
|
28
|
+
When I successfully run `adlint fixture.c` on noarch
|
29
|
+
Then the output should exactly match with:
|
30
|
+
| mesg | line | column |
|
31
|
+
| W0442 | 3 | 1 |
|
32
|
+
| W0442 | 4 | 1 |
|
33
|
+
| W0118 | 1 | 12 |
|
34
|
+
| W0117 | 8 | 6 |
|
35
|
+
| W0609 | 14 | 9 |
|
36
|
+
| W0609 | 16 | 9 |
|
37
|
+
| W0443 | 3 | 1 |
|
38
|
+
| W0443 | 4 | 1 |
|
39
|
+
| W0628 | 8 | 6 |
|
40
|
+
|
41
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: W0432
|
2
|
+
|
3
|
+
W0432 detects that indentation of this line does not match with the project's
|
4
|
+
indentation style.
|
5
|
+
|
6
|
+
Scenario: function-like macro replacement
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
extern int foo(int, int);
|
10
|
+
|
11
|
+
#define bar(a, b) ((a) > 0) ? (a) : (b)
|
12
|
+
#define baz(a, b) \
|
13
|
+
((a) > 0) ? \
|
14
|
+
(a) : (b)
|
15
|
+
|
16
|
+
void qux(void)
|
17
|
+
{
|
18
|
+
int i = 0;
|
19
|
+
|
20
|
+
i = foo(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
21
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
22
|
+
i = bar(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
23
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
24
|
+
i = baz(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1, /* OK */
|
25
|
+
2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2); /* OK */
|
26
|
+
}
|
27
|
+
"""
|
28
|
+
When I successfully run `adlint fixture.c` on noarch
|
29
|
+
Then the output should exactly match with:
|
30
|
+
| mesg | line | column |
|
31
|
+
| W0442 | 3 | 1 |
|
32
|
+
| W0442 | 4 | 1 |
|
33
|
+
| W0118 | 1 | 12 |
|
34
|
+
| W0117 | 8 | 6 |
|
35
|
+
| W0609 | 14 | 9 |
|
36
|
+
| W0609 | 16 | 9 |
|
37
|
+
| W0443 | 3 | 1 |
|
38
|
+
| W0443 | 4 | 1 |
|
39
|
+
| W0628 | 8 | 6 |
|
40
|
+
|
41
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: W0787
|
2
|
+
|
3
|
+
W0787 detects that a variable defined with a type which is different with one
|
4
|
+
of previously defined variable in the other scope.
|
5
|
+
|
6
|
+
Scenario: different types of local variables of the same name
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
int foo(void)
|
10
|
+
{
|
11
|
+
int retval = 0;
|
12
|
+
return retval;
|
13
|
+
}
|
14
|
+
|
15
|
+
long bar(void)
|
16
|
+
{
|
17
|
+
long retval = 0; /* OK */
|
18
|
+
return retval;
|
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
|
+
| W0117 | 1 | 5 |
|
25
|
+
| W0100 | 3 | 9 |
|
26
|
+
| W0117 | 7 | 6 |
|
27
|
+
| W0100 | 9 | 10 |
|
28
|
+
| W0628 | 1 | 5 |
|
29
|
+
| W0628 | 7 | 6 |
|
30
|
+
|
31
|
+
Scenario: different types of `extern' variables of the same name
|
32
|
+
Given a target source named "fixture.c" with:
|
33
|
+
"""
|
34
|
+
void foo(void)
|
35
|
+
{
|
36
|
+
extern int retval;
|
37
|
+
retval = 0;
|
38
|
+
}
|
39
|
+
|
40
|
+
void bar(void)
|
41
|
+
{
|
42
|
+
extern long retval; /* W0787 */
|
43
|
+
retval = 0;
|
44
|
+
}
|
45
|
+
"""
|
46
|
+
When I successfully run `adlint fixture.c` on noarch
|
47
|
+
Then the output should exactly match with:
|
48
|
+
| mesg | line | column |
|
49
|
+
| W0117 | 1 | 6 |
|
50
|
+
| W0118 | 3 | 16 |
|
51
|
+
| W0623 | 3 | 16 |
|
52
|
+
| W0117 | 7 | 6 |
|
53
|
+
| W0118 | 9 | 17 |
|
54
|
+
| W0623 | 9 | 17 |
|
55
|
+
| W0787 | 9 | 17 |
|
56
|
+
| W0628 | 1 | 6 |
|
57
|
+
| W0628 | 7 | 6 |
|
58
|
+
| W1037 | 3 | 16 |
|
59
|
+
| W1037 | 9 | 17 |
|
60
|
+
|
61
|
+
# vim:ts=2:sw=2:sts=2:et:
|
data/lib/adlint/c/ctrlexpr.rb
CHANGED
@@ -130,7 +130,7 @@ module C #:nodoc:
|
|
130
130
|
|
131
131
|
def complexly_compounded?
|
132
132
|
# NOTE: This method determines whether the controlling expression is too
|
133
|
-
# complex to
|
133
|
+
# complex to thin value domains of controlling variables.
|
134
134
|
@expression && !collect_logical_and_expressions(@expression).empty?
|
135
135
|
end
|
136
136
|
end
|
data/lib/adlint/cpp/macro.rb
CHANGED
@@ -199,7 +199,7 @@ module Cpp #:nodoc:
|
|
199
199
|
|
200
200
|
case
|
201
201
|
when arg = args[curr_token.value]
|
202
|
-
substitute_argument(curr_token, next_token, arg, result,
|
202
|
+
substitute_argument(curr_token, next_token, arg, location, result,
|
203
203
|
macro_table, context)
|
204
204
|
when curr_token.value == "#"
|
205
205
|
if next_token and arg = args[next_token.value] || []
|
@@ -230,7 +230,7 @@ module Cpp #:nodoc:
|
|
230
230
|
result
|
231
231
|
end
|
232
232
|
|
233
|
-
def substitute_argument(param_token, next_token, arg, result,
|
233
|
+
def substitute_argument(param_token, next_token, arg, location, result,
|
234
234
|
macro_table, context)
|
235
235
|
# NOTE: The ISO C99 standard saids;
|
236
236
|
#
|
@@ -247,12 +247,12 @@ module Cpp #:nodoc:
|
|
247
247
|
|
248
248
|
if next_token && next_token.value == "##"
|
249
249
|
result.concat(arg.map { |t|
|
250
|
-
ReplacedToken.new(t.type, t.value,
|
250
|
+
ReplacedToken.new(t.type, t.value, location, t.type_hint, false)
|
251
251
|
})
|
252
252
|
else
|
253
253
|
macro_table.replace(arg, context)
|
254
254
|
result.concat(arg.map { |t|
|
255
|
-
ReplacedToken.new(t.type, t.value,
|
255
|
+
ReplacedToken.new(t.type, t.value, location, t.type_hint, true)
|
256
256
|
})
|
257
257
|
end
|
258
258
|
end
|
@@ -7089,7 +7089,11 @@ module CBuiltin #:nodoc:
|
|
7089
7089
|
@indent_level = 0
|
7090
7090
|
@indent_widths = Hash.new(0)
|
7091
7091
|
@paren_depth = 0
|
7092
|
-
@
|
7092
|
+
@last_token = nil
|
7093
|
+
end
|
7094
|
+
|
7095
|
+
def last_line_no
|
7096
|
+
@last_token ? @last_token.location.line_no : 0
|
7093
7097
|
end
|
7094
7098
|
|
7095
7099
|
def do_execute(context)
|
@@ -7107,7 +7111,7 @@ module CBuiltin #:nodoc:
|
|
7107
7111
|
|
7108
7112
|
case token.type
|
7109
7113
|
when :IF, :FOR, :WHILE
|
7110
|
-
if
|
7114
|
+
if last_line_no < token.location.line_no
|
7111
7115
|
on_beginning_of_line(token)
|
7112
7116
|
end
|
7113
7117
|
skip_controlling_part
|
@@ -7115,21 +7119,21 @@ module CBuiltin #:nodoc:
|
|
7115
7119
|
skip_simple_substatement
|
7116
7120
|
end
|
7117
7121
|
when :ELSE
|
7118
|
-
if
|
7122
|
+
if last_line_no < token.location.line_no
|
7119
7123
|
on_beginning_of_line(token)
|
7120
7124
|
end
|
7121
7125
|
unless token = peek_token and token.type == :IF || token.type == "{"
|
7122
7126
|
skip_simple_substatement
|
7123
7127
|
end
|
7124
7128
|
when :DO
|
7125
|
-
if
|
7129
|
+
if last_line_no < token.location.line_no
|
7126
7130
|
on_beginning_of_line(token)
|
7127
7131
|
end
|
7128
7132
|
unless token = peek_token and token.type == "{"
|
7129
7133
|
skip_simple_substatement
|
7130
7134
|
end
|
7131
7135
|
else
|
7132
|
-
if
|
7136
|
+
if last_line_no < token.location.line_no
|
7133
7137
|
on_beginning_of_line(token)
|
7134
7138
|
end
|
7135
7139
|
end
|
@@ -7205,7 +7209,7 @@ module CBuiltin #:nodoc:
|
|
7205
7209
|
|
7206
7210
|
def peek_token
|
7207
7211
|
if token = @tokens[@index]
|
7208
|
-
@
|
7212
|
+
@last_token = @tokens[[0, @index - 1].max]
|
7209
7213
|
checkpoint(token.location)
|
7210
7214
|
end
|
7211
7215
|
token
|
@@ -7237,7 +7241,7 @@ module CBuiltin #:nodoc:
|
|
7237
7241
|
end
|
7238
7242
|
|
7239
7243
|
def on_beginning_of_line(token)
|
7240
|
-
return if @paren_depth > 0
|
7244
|
+
return if @paren_depth > 0 || @last_token.replaced?
|
7241
7245
|
|
7242
7246
|
case token.type
|
7243
7247
|
when "{"
|
@@ -7280,7 +7284,11 @@ module CBuiltin #:nodoc:
|
|
7280
7284
|
@indent_level = 0
|
7281
7285
|
@indent_width = indent_width
|
7282
7286
|
@paren_depth = 0
|
7283
|
-
@
|
7287
|
+
@last_token = nil
|
7288
|
+
end
|
7289
|
+
|
7290
|
+
def last_line_no
|
7291
|
+
@last_token ? @last_token.location.line_no : 0
|
7284
7292
|
end
|
7285
7293
|
|
7286
7294
|
def do_execute(context)
|
@@ -7298,7 +7306,7 @@ module CBuiltin #:nodoc:
|
|
7298
7306
|
|
7299
7307
|
case token.type
|
7300
7308
|
when :IF, :FOR, :WHILE
|
7301
|
-
if
|
7309
|
+
if last_line_no < token.location.line_no
|
7302
7310
|
on_beginning_of_line(token)
|
7303
7311
|
end
|
7304
7312
|
skip_controlling_part
|
@@ -7306,21 +7314,21 @@ module CBuiltin #:nodoc:
|
|
7306
7314
|
process_simple_substatement
|
7307
7315
|
end
|
7308
7316
|
when :ELSE
|
7309
|
-
if
|
7317
|
+
if last_line_no < token.location.line_no
|
7310
7318
|
on_beginning_of_line(token)
|
7311
7319
|
end
|
7312
7320
|
unless token = peek_token and token.type == :IF || token.type == "{"
|
7313
7321
|
process_simple_substatement
|
7314
7322
|
end
|
7315
7323
|
when :DO
|
7316
|
-
if
|
7324
|
+
if last_line_no < token.location.line_no
|
7317
7325
|
on_beginning_of_line(token)
|
7318
7326
|
end
|
7319
7327
|
unless token = peek_token and token.type == "{"
|
7320
7328
|
process_simple_substatement
|
7321
7329
|
end
|
7322
7330
|
else
|
7323
|
-
if
|
7331
|
+
if last_line_no < token.location.line_no
|
7324
7332
|
on_beginning_of_line(token)
|
7325
7333
|
end
|
7326
7334
|
end
|
@@ -7356,7 +7364,7 @@ module CBuiltin #:nodoc:
|
|
7356
7364
|
|
7357
7365
|
case token.type
|
7358
7366
|
when :IF, :FOR, :WHILE
|
7359
|
-
if
|
7367
|
+
if last_line_no < token.location.line_no
|
7360
7368
|
on_beginning_of_line(token)
|
7361
7369
|
end
|
7362
7370
|
skip_controlling_part
|
@@ -7365,7 +7373,7 @@ module CBuiltin #:nodoc:
|
|
7365
7373
|
break
|
7366
7374
|
end
|
7367
7375
|
when :ELSE
|
7368
|
-
if
|
7376
|
+
if last_line_no < token.location.line_no
|
7369
7377
|
on_beginning_of_line(token)
|
7370
7378
|
end
|
7371
7379
|
unless token = peek_token and token.type == :IF || token.type == "{"
|
@@ -7373,7 +7381,7 @@ module CBuiltin #:nodoc:
|
|
7373
7381
|
break
|
7374
7382
|
end
|
7375
7383
|
when :DO
|
7376
|
-
if
|
7384
|
+
if last_line_no < token.location.line_no
|
7377
7385
|
on_beginning_of_line(token)
|
7378
7386
|
end
|
7379
7387
|
unless token = peek_token and token.type == "{"
|
@@ -7382,7 +7390,7 @@ module CBuiltin #:nodoc:
|
|
7382
7390
|
break
|
7383
7391
|
end
|
7384
7392
|
else
|
7385
|
-
if
|
7393
|
+
if last_line_no < token.location.line_no
|
7386
7394
|
on_beginning_of_line(token)
|
7387
7395
|
end
|
7388
7396
|
break if token.type == ";"
|
@@ -7413,7 +7421,7 @@ module CBuiltin #:nodoc:
|
|
7413
7421
|
|
7414
7422
|
def peek_token
|
7415
7423
|
if token = @tokens[@index]
|
7416
|
-
@
|
7424
|
+
@last_token = @tokens[[0, @index - 1].max]
|
7417
7425
|
checkpoint(token.location)
|
7418
7426
|
end
|
7419
7427
|
token
|
@@ -7445,7 +7453,7 @@ module CBuiltin #:nodoc:
|
|
7445
7453
|
end
|
7446
7454
|
|
7447
7455
|
def on_beginning_of_line(token)
|
7448
|
-
return if @paren_depth > 0
|
7456
|
+
return if @paren_depth > 0 || @last_token.replaced?
|
7449
7457
|
|
7450
7458
|
case token.type
|
7451
7459
|
when "{"
|
@@ -15836,7 +15844,9 @@ module CBuiltin #:nodoc:
|
|
15836
15844
|
end
|
15837
15845
|
|
15838
15846
|
private
|
15839
|
-
def check_object_declaration(declaration_or_definition,
|
15847
|
+
def check_object_declaration(declaration_or_definition, object)
|
15848
|
+
return unless object.declared_as_extern?
|
15849
|
+
|
15840
15850
|
name = declaration_or_definition.identifier.value
|
15841
15851
|
type = declaration_or_definition.type
|
15842
15852
|
|
@@ -79,7 +79,7 @@ module CBuiltin #:nodoc:
|
|
79
79
|
private
|
80
80
|
def check_user_include(user_include_line, user_header)
|
81
81
|
if @user_header_fpaths.include?(user_header.fpath)
|
82
|
-
W(:W0025, user_include_line.location)
|
82
|
+
W(:W0025, user_include_line.location, user_include_line.fpath)
|
83
83
|
else
|
84
84
|
if user_include_line.include_depth == 1
|
85
85
|
@user_header_fpaths.add(user_header.fpath)
|
@@ -89,7 +89,7 @@ module CBuiltin #:nodoc:
|
|
89
89
|
|
90
90
|
def check_system_include(system_include_line, system_header)
|
91
91
|
if @system_header_fpaths.include?(system_header.fpath)
|
92
|
-
W(:W0025, system_include_line.location)
|
92
|
+
W(:W0025, system_include_line.location, system_include_line.fpath)
|
93
93
|
else
|
94
94
|
if system_include_line.include_depth == 1
|
95
95
|
@system_header_fpaths.add(system_header.fpath)
|
@@ -113,7 +113,7 @@ module CBuiltin #:nodoc:
|
|
113
113
|
private
|
114
114
|
def check_user_include(user_include_line, user_header)
|
115
115
|
if @user_header_fpaths.include?(user_header.fpath)
|
116
|
-
W(:W0026, user_include_line.location)
|
116
|
+
W(:W0026, user_include_line.location, user_include_line.fpath)
|
117
117
|
else
|
118
118
|
if user_include_line.include_depth > 1
|
119
119
|
@user_header_fpaths.add(user_header.fpath)
|
@@ -123,7 +123,7 @@ module CBuiltin #:nodoc:
|
|
123
123
|
|
124
124
|
def check_system_include(system_include_line, system_header)
|
125
125
|
if @system_header_fpaths.include?(system_header.fpath)
|
126
|
-
W(:W0026, system_include_line.location)
|
126
|
+
W(:W0026, system_include_line.location, system_include_line.fpath)
|
127
127
|
else
|
128
128
|
if system_include_line.include_depth > 1
|
129
129
|
@system_header_fpaths.add(system_header.fpath)
|
data/lib/adlint/prelude.rb
CHANGED
@@ -307,12 +307,12 @@ end
|
|
307
307
|
# env_var_name : [A-Za-z_][0-9A-Za-z_]*
|
308
308
|
#
|
309
309
|
# Examples of environment variable as any scalar value;
|
310
|
-
#
|
310
|
+
# string_item: $VAR
|
311
311
|
# boolean_item: $VAR
|
312
312
|
# decimal_item: $VAR
|
313
313
|
#
|
314
314
|
# Examples of embedding environment variable in string;
|
315
|
-
#
|
315
|
+
# string_item: "foo${VAR}baz"
|
316
316
|
#
|
317
317
|
class Psych::TreeBuilder < Psych::Handler
|
318
318
|
alias :_orig_scalar :scalar
|
data/lib/adlint/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="ja">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 2.0
|
3
|
+
<title>AdLint 2.2.0 開発者ガイド</title>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<meta name="description" content="AdLint 2.0
|
5
|
+
<meta name="description" content="AdLint 2.2.0 開発者ガイド">
|
6
6
|
<meta name="generator" content="makeinfo 4.13">
|
7
7
|
<link title="Top" rel="top" href="#Top">
|
8
8
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
|
|
44
44
|
--></style>
|
45
45
|
</head>
|
46
46
|
<body>
|
47
|
-
<h1 class="settitle">AdLint 2.0
|
47
|
+
<h1 class="settitle">AdLint 2.2.0 開発者ガイド</h1>
|
48
48
|
<div class="contents">
|
49
49
|
<h2>Table of Contents</h2>
|
50
50
|
<ul>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="en">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 2.0
|
3
|
+
<title>AdLint 2.2.0 User's Guide</title>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<meta name="description" content="AdLint 2.0
|
5
|
+
<meta name="description" content="AdLint 2.2.0 User's Guide">
|
6
6
|
<meta name="generator" content="makeinfo 4.13">
|
7
7
|
<link title="Top" rel="top" href="#Top">
|
8
8
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
|
|
44
44
|
--></style>
|
45
45
|
</head>
|
46
46
|
<body>
|
47
|
-
<h1 class="settitle">AdLint 2.0
|
47
|
+
<h1 class="settitle">AdLint 2.2.0 User's Guide</h1>
|
48
48
|
<div class="node">
|
49
49
|
<a name="Top"></a>
|
50
50
|
<p><hr>
|
@@ -2286,8 +2286,8 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a>
|
|
2286
2286
|
<li><a href="#W0021">W0021</a>: This pointer cast is danger because it delete volatile qualifier.
|
2287
2287
|
<li><a href="#W0023">W0023</a>: Arithmetic operation is being made by pointer variable.
|
2288
2288
|
<li><a href="#W0024">W0024</a>: Increment or decrement is being made by pointer variable.
|
2289
|
-
<li><a href="#W0025">W0025</a>:
|
2290
|
-
<li><a href="#W0026">W0026</a>:
|
2289
|
+
<li><a href="#W0025">W0025</a>: `%s' is already included by this file directly.
|
2290
|
+
<li><a href="#W0026">W0026</a>: `%s' is already included by this file indirectly.
|
2291
2291
|
<li><a href="#W0027">W0027</a>: Comparison operation is being made by pointer variable.
|
2292
2292
|
<li><a href="#W0028">W0028</a>: Indirect referencing is being made by NULL pointer.
|
2293
2293
|
<li><a href="#W0030">W0030</a>: Arithmetic operation is being made by NULL pointer.
|
@@ -3987,7 +3987,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
3987
3987
|
|
3988
3988
|
<h4 class="subsection">6.27.1 Message body</h4>
|
3989
3989
|
|
3990
|
-
<p
|
3990
|
+
<p>`%s' is already included by this file directly.
|
3991
3991
|
|
3992
3992
|
<h4 class="subsection">6.27.2 Content</h4>
|
3993
3993
|
|
@@ -4003,7 +4003,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4003
4003
|
<h4 class="subsection">6.27.4 Related message</h4>
|
4004
4004
|
|
4005
4005
|
<ul>
|
4006
|
-
<li><a href="#W0026">W0026</a>
|
4006
|
+
<li><a href="#W0026">W0026</a> `%s' is already included by this file indirectly.
|
4007
4007
|
</ul>
|
4008
4008
|
|
4009
4009
|
<h4 class="subsection">6.27.5 Since</h4>
|
@@ -4025,7 +4025,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4025
4025
|
|
4026
4026
|
<h4 class="subsection">6.28.1 Message body</h4>
|
4027
4027
|
|
4028
|
-
<p
|
4028
|
+
<p>`%s' is already included by this file indirectly.
|
4029
4029
|
|
4030
4030
|
<h4 class="subsection">6.28.2 Content</h4>
|
4031
4031
|
|
@@ -4045,7 +4045,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4045
4045
|
<h4 class="subsection">6.28.4 Related message</h4>
|
4046
4046
|
|
4047
4047
|
<ul>
|
4048
|
-
<li><a href="#W0025">W0025</a>
|
4048
|
+
<li><a href="#W0025">W0025</a> `%s' is already included by this file directly.
|
4049
4049
|
</ul>
|
4050
4050
|
|
4051
4051
|
<h4 class="subsection">6.28.5 Since</h4>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
@setfilename users_guide_en.info
|
3
3
|
@documentlanguage en
|
4
4
|
@documentencoding utf-8
|
5
|
-
@settitle AdLint 2.0
|
5
|
+
@settitle AdLint 2.2.0 User's Guide
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -2312,8 +2312,8 @@ context_line (in case of @ref{message_traits:message_with_class, message_with_cl
|
|
2312
2312
|
* W0021::This pointer cast is danger because it delete volatile qualifier.
|
2313
2313
|
* W0023::Arithmetic operation is being made by pointer variable.
|
2314
2314
|
* W0024::Increment or decrement is being made by pointer variable.
|
2315
|
-
* W0025
|
2316
|
-
* W0026
|
2315
|
+
* W0025::`%s' is already included by this file directly.
|
2316
|
+
* W0026::`%s' is already included by this file indirectly.
|
2317
2317
|
* W0027::Comparison operation is being made by pointer variable.
|
2318
2318
|
* W0028::Indirect referencing is being made by NULL pointer.
|
2319
2319
|
* W0030::Arithmetic operation is being made by NULL pointer.
|
@@ -3791,7 +3791,7 @@ p++; /* W0024 */
|
|
3791
3791
|
|
3792
3792
|
@subsection Message body
|
3793
3793
|
|
3794
|
-
|
3794
|
+
`%s' is already included by this file directly.
|
3795
3795
|
|
3796
3796
|
@subsection Content
|
3797
3797
|
|
@@ -3808,7 +3808,7 @@ Under construction.
|
|
3808
3808
|
@subsection Related message
|
3809
3809
|
|
3810
3810
|
@itemize
|
3811
|
-
@item @ref{W0026}
|
3811
|
+
@item @ref{W0026} `%s' is already included by this file indirectly.
|
3812
3812
|
@end itemize
|
3813
3813
|
|
3814
3814
|
@subsection Since
|
@@ -3821,7 +3821,8 @@ Under construction.
|
|
3821
3821
|
|
3822
3822
|
@subsection Message body
|
3823
3823
|
|
3824
|
-
|
3824
|
+
`%s' is already included by this file indirectly.
|
3825
|
+
|
3825
3826
|
@subsection Content
|
3826
3827
|
|
3827
3828
|
Under construction.
|
@@ -3842,7 +3843,7 @@ Under construction.
|
|
3842
3843
|
@subsection Related message
|
3843
3844
|
|
3844
3845
|
@itemize
|
3845
|
-
@item @ref{W0025}
|
3846
|
+
@item @ref{W0025} `%s' is already included by this file directly.
|
3846
3847
|
@end itemize
|
3847
3848
|
|
3848
3849
|
@subsection Since
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="ja">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 2.0
|
3
|
+
<title>AdLint 2.2.0 利用者ガイド</title>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<meta name="description" content="AdLint 2.0
|
5
|
+
<meta name="description" content="AdLint 2.2.0 利用者ガイド">
|
6
6
|
<meta name="generator" content="makeinfo 4.13">
|
7
7
|
<link title="Top" rel="top" href="#Top">
|
8
8
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
|
|
44
44
|
--></style>
|
45
45
|
</head>
|
46
46
|
<body>
|
47
|
-
<h1 class="settitle">AdLint 2.0
|
47
|
+
<h1 class="settitle">AdLint 2.2.0 利用者ガイド</h1>
|
48
48
|
<div class="node">
|
49
49
|
<a name="Top"></a>
|
50
50
|
<p><hr>
|
@@ -2358,8 +2358,8 @@ Up: <a rel="up" accesskey="u" href="#Top">Top</a>
|
|
2358
2358
|
<li><a href="#W0021">W0021</a>: このポインタキャストは、volatile 修飾を削除しているので危険です。
|
2359
2359
|
<li><a href="#W0023">W0023</a>: ポインタ型の変数に対して算術演算が行われています。
|
2360
2360
|
<li><a href="#W0024">W0024</a>: ポインタ型の変数に対してインクリメントまたはデクリメントが行われています。
|
2361
|
-
<li><a href="#W0025">W0025</a>:
|
2362
|
-
<li><a href="#W0026">W0026</a>:
|
2361
|
+
<li><a href="#W0025">W0025</a>: `%s' は、既にこのファイルから直接インクルードされています。
|
2362
|
+
<li><a href="#W0026">W0026</a>: `%s' は、既にこのファイルから間接的にインクルードされています。
|
2363
2363
|
<li><a href="#W0027">W0027</a>: ポインタ型の変数に対して比較演算が行われています。
|
2364
2364
|
<li><a href="#W0028">W0028</a>: NULL ポインタに対して間接参照が行われています。
|
2365
2365
|
<li><a href="#W0030">W0030</a>: NULL ポインタに対して算術演算が行われています。
|
@@ -4084,7 +4084,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4084
4084
|
|
4085
4085
|
<h4 class="subsection">6.27.1 メッセージ本文</h4>
|
4086
4086
|
|
4087
|
-
<p
|
4087
|
+
<p>`%s' は、既にこのファイルから直接インクルードされています。
|
4088
4088
|
|
4089
4089
|
<h4 class="subsection">6.27.2 内容</h4>
|
4090
4090
|
|
@@ -4100,7 +4100,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4100
4100
|
<h4 class="subsection">6.27.4 関連メッセージ</h4>
|
4101
4101
|
|
4102
4102
|
<ul>
|
4103
|
-
<li><a href="#W0026">W0026</a>
|
4103
|
+
<li><a href="#W0026">W0026</a> `%s' は、既にこのファイルから間接的にインクルードされています。
|
4104
4104
|
</ul>
|
4105
4105
|
|
4106
4106
|
<h4 class="subsection">6.27.5 対応バージョン</h4>
|
@@ -4122,7 +4122,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4122
4122
|
|
4123
4123
|
<h4 class="subsection">6.28.1 メッセージ本文</h4>
|
4124
4124
|
|
4125
|
-
<p
|
4125
|
+
<p>`%s' は、既にこのファイルから間接的にインクルードされています。
|
4126
4126
|
|
4127
4127
|
<h4 class="subsection">6.28.2 内容</h4>
|
4128
4128
|
|
@@ -4142,7 +4142,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
4142
4142
|
<h4 class="subsection">6.28.4 関連メッセージ</h4>
|
4143
4143
|
|
4144
4144
|
<ul>
|
4145
|
-
<li><a href="#W0025">W0025</a>
|
4145
|
+
<li><a href="#W0025">W0025</a> `%s' は、既にこのファイルから直接インクルードされています。
|
4146
4146
|
</ul>
|
4147
4147
|
|
4148
4148
|
<h4 class="subsection">6.28.5 対応バージョン</h4>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
@setfilename users_guide_ja.info
|
3
3
|
@documentlanguage ja
|
4
4
|
@documentencoding utf-8
|
5
|
-
@settitle AdLint 2.0
|
5
|
+
@settitle AdLint 2.2.0 利用者ガイド
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -2377,8 +2377,8 @@ context_line (in case of @ref{message_traits:message_with_class, message_with_cl
|
|
2377
2377
|
* W0021::このポインタキャストは、volatile 修飾を削除しているので危険です。
|
2378
2378
|
* W0023::ポインタ型の変数に対して算術演算が行われています。
|
2379
2379
|
* W0024::ポインタ型の変数に対してインクリメントまたはデクリメントが行われています。
|
2380
|
-
* W0025
|
2381
|
-
* W0026
|
2380
|
+
* W0025::`%s' は、既にこのファイルから直接インクルードされています。
|
2381
|
+
* W0026::`%s' は、既にこのファイルから間接的にインクルードされています。
|
2382
2382
|
* W0027::ポインタ型の変数に対して比較演算が行われています。
|
2383
2383
|
* W0028::NULL ポインタに対して間接参照が行われています。
|
2384
2384
|
* W0030::NULL ポインタに対して算術演算が行われています。
|
@@ -3878,7 +3878,7 @@ p++; /* W0024 */
|
|
3878
3878
|
|
3879
3879
|
@subsection メッセージ本文
|
3880
3880
|
|
3881
|
-
|
3881
|
+
`%s' は、既にこのファイルから直接インクルードされています。
|
3882
3882
|
|
3883
3883
|
@subsection 内容
|
3884
3884
|
|
@@ -3895,7 +3895,7 @@ p++; /* W0024 */
|
|
3895
3895
|
@subsection 関連メッセージ
|
3896
3896
|
|
3897
3897
|
@itemize
|
3898
|
-
@item @ref{W0026}
|
3898
|
+
@item @ref{W0026} `%s' は、既にこのファイルから間接的にインクルードされています。
|
3899
3899
|
@end itemize
|
3900
3900
|
|
3901
3901
|
@subsection 対応バージョン
|
@@ -3908,7 +3908,7 @@ p++; /* W0024 */
|
|
3908
3908
|
|
3909
3909
|
@subsection メッセージ本文
|
3910
3910
|
|
3911
|
-
|
3911
|
+
`%s' は、既にこのファイルから間接的にインクルードされています。
|
3912
3912
|
|
3913
3913
|
@subsection 内容
|
3914
3914
|
|
@@ -3930,7 +3930,7 @@ p++; /* W0024 */
|
|
3930
3930
|
@subsection 関連メッセージ
|
3931
3931
|
|
3932
3932
|
@itemize
|
3933
|
-
@item @ref{W0025}
|
3933
|
+
@item @ref{W0025} `%s' は、既にこのファイルから直接インクルードされています。
|
3934
3934
|
@end itemize
|
3935
3935
|
|
3936
3936
|
@subsection 対応バージョン
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'AdLint is a source code static analyzer.
|
15
15
|
|
@@ -215,6 +215,8 @@ files:
|
|
215
215
|
- features/code_check/W0252.feature
|
216
216
|
- features/code_check/W0253.feature
|
217
217
|
- features/code_check/W0254.feature
|
218
|
+
- features/code_check/W0431.feature
|
219
|
+
- features/code_check/W0432.feature
|
218
220
|
- features/code_check/W0477.feature
|
219
221
|
- features/code_check/W0478.feature
|
220
222
|
- features/code_check/W0479.feature
|
@@ -291,6 +293,7 @@ files:
|
|
291
293
|
- features/code_check/W0780.feature
|
292
294
|
- features/code_check/W0781.feature
|
293
295
|
- features/code_check/W0783.feature
|
296
|
+
- features/code_check/W0787.feature
|
294
297
|
- features/code_check/W0792.feature
|
295
298
|
- features/code_check/W0793.feature
|
296
299
|
- features/code_check/W0794.feature
|