adlint 2.6.0 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +122 -0
- data/MANIFEST +1 -0
- data/NEWS +23 -4
- data/README +1 -1
- data/Rakefile +1 -1
- data/etc/mesg.d/c_builtin/en_US/messages.yml +8 -8
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +8 -8
- 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/W0599.feature +71 -0
- data/lib/adlint/c/builtin.rb +1 -1
- data/lib/adlint/c/const.rb +60 -60
- data/lib/adlint/c/conv.rb +3 -3
- data/lib/adlint/c/ctrlexpr.rb +278 -357
- data/lib/adlint/c/expr.rb +1232 -1637
- data/lib/adlint/c/format.rb +26 -26
- data/lib/adlint/c/interp.rb +339 -391
- data/lib/adlint/c/mediator.rb +1 -2
- data/lib/adlint/c/object.rb +8 -9
- data/lib/adlint/c/seqp.rb +1 -1
- data/lib/adlint/c/syntax.rb +6 -6
- data/lib/adlint/c/type.rb +8 -8
- data/lib/adlint/cpp/eval.rb +1 -1
- data/lib/adlint/cpp/macro.rb +4 -4
- data/lib/adlint/cpp/util.rb +1 -1
- data/lib/adlint/exam/c_builtin/c_check.rb +93 -95
- data/lib/adlint/exam/c_builtin/ld_check.rb +4 -4
- data/lib/adlint/traits.rb +7 -16
- data/lib/adlint/util.rb +12 -0
- 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 +32 -32
- data/share/doc/users_guide_en.texi +30 -30
- data/share/doc/users_guide_ja.html +32 -32
- data/share/doc/users_guide_ja.texi +30 -30
- metadata +4 -3
data/ChangeLog
CHANGED
@@ -1,3 +1,125 @@
|
|
1
|
+
Wed Oct 31 10:16:44 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
|
+
|
3
|
+
* release.ga : 2.6.2
|
4
|
+
- Fix compound-assignment-expression evaluation not to propagate
|
5
|
+
initialization status of the rhs operand.
|
6
|
+
- Fix bad traits file parser in order to parse compound pathname
|
7
|
+
strings correctly on mswin.
|
8
|
+
- Clarify W0082 message text by adding underlying type name of the
|
9
|
+
operand.
|
10
|
+
- Clarify W0578 and W0579 message texts by adding source and
|
11
|
+
destination type names of the conversion.
|
12
|
+
- Clarify W0650 message text by adding lhs type name of the
|
13
|
+
shift-expression.
|
14
|
+
- Clarify W0719 message text by adding lhs underlying type name of
|
15
|
+
the shift-expression.
|
16
|
+
- Clarify W1051 and W1052 message texts by adding type name of the
|
17
|
+
arithmetic expression.
|
18
|
+
- Fix the interpreter to place sequence-point at the end of the
|
19
|
+
return-statement evaluation.
|
20
|
+
|
21
|
+
Tue Oct 30 15:08:22 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
22
|
+
|
23
|
+
* release.rc : 2.6.1
|
24
|
+
- Fix compound-assignment-expression evaluation not to propagate
|
25
|
+
initialization status of the rhs operand.
|
26
|
+
- Fix bad traits file parser in order to parse compound pathname
|
27
|
+
strings correctly on mswin.
|
28
|
+
- Clarify W0082 message text by adding underlying type name of the
|
29
|
+
operand.
|
30
|
+
- Clarify W0578 and W0579 message texts by adding source and
|
31
|
+
destination type names of the conversion.
|
32
|
+
- Clarify W0650 message text by adding lhs type name of the
|
33
|
+
shift-expression.
|
34
|
+
- Clarify W0719 message text by adding lhs underlying type name of
|
35
|
+
the shift-expression.
|
36
|
+
- Clarify W1051 and W1052 message texts by adding type name of the
|
37
|
+
arithmetic expression.
|
38
|
+
- Fix the interpreter to place sequence-point at the end of the
|
39
|
+
return-statement evaluation.
|
40
|
+
|
41
|
+
Tue Oct 30 15:05:37 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
42
|
+
|
43
|
+
* features/code_check/W0599.feature : Add W0599 specification.
|
44
|
+
* MANIFEST : Ditto.
|
45
|
+
|
46
|
+
* lib/adlint/c/interp.rb : Fix the interpreter to place sequence-point
|
47
|
+
at the end of the return-statement evaluation.
|
48
|
+
|
49
|
+
Mon Oct 29 19:11:17 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
50
|
+
|
51
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W1052 message text by
|
52
|
+
adding type name of the arithmetic expression.
|
53
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
54
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
55
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
56
|
+
* share/doc/users_guide_en.texi : Ditto.
|
57
|
+
|
58
|
+
Mon Oct 29 18:56:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
59
|
+
|
60
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W1051 message text by
|
61
|
+
adding type name of the arithmetic expression.
|
62
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
63
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
64
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
65
|
+
* share/doc/users_guide_en.texi : Ditto.
|
66
|
+
|
67
|
+
Mon Oct 29 18:46:23 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
68
|
+
|
69
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W0719 message text by
|
70
|
+
adding lhs underlying type name of the shift-expression.
|
71
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
72
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
73
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
74
|
+
* share/doc/users_guide_en.texi : Ditto.
|
75
|
+
|
76
|
+
Mon Oct 29 18:34:18 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
77
|
+
|
78
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W0650 message text by
|
79
|
+
adding lhs type name of the shift-expression.
|
80
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
81
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
82
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
83
|
+
* share/doc/users_guide_en.texi : Ditto.
|
84
|
+
|
85
|
+
Mon Oct 29 17:59:15 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
86
|
+
|
87
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W0579 message text by
|
88
|
+
adding source and destination type names of the conversion.
|
89
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
90
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
91
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
92
|
+
* share/doc/users_guide_en.texi : Ditto.
|
93
|
+
|
94
|
+
Mon Oct 29 17:43:41 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
95
|
+
|
96
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W0578 message text by
|
97
|
+
adding source and destination type names of the conversion.
|
98
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
99
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
100
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
101
|
+
* share/doc/users_guide_en.texi : Ditto.
|
102
|
+
|
103
|
+
Mon Oct 29 17:14:25 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
104
|
+
|
105
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Clarify W0082 message text by
|
106
|
+
adding underlying type name of the operand.
|
107
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Ditto.
|
108
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
109
|
+
* share/doc/users_guide_ja.texi : Ditto.
|
110
|
+
* share/doc/users_guide_en.texi : Ditto.
|
111
|
+
|
112
|
+
Mon Oct 29 15:21:18 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
113
|
+
|
114
|
+
* lib/adlint/traits.rb : Fix bad traits file parser in order to parse
|
115
|
+
compound pathname strings correctly on mswin.
|
116
|
+
* lib/adlint/util.rb : Ditto.
|
117
|
+
|
118
|
+
Mon Oct 29 14:37:19 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
119
|
+
|
120
|
+
* lib/adlint/c/expr.rb : Fix compound-assignment-expression evaluation
|
121
|
+
not to propagate initialization status of the rhs operand.
|
122
|
+
|
1
123
|
Mon Oct 22 15:02:29 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
124
|
|
3
125
|
* release.ga : 2.6.0
|
data/MANIFEST
CHANGED
@@ -210,6 +210,7 @@ features/code_check/W0573.feature
|
|
210
210
|
features/code_check/W0582.feature
|
211
211
|
features/code_check/W0583.feature
|
212
212
|
features/code_check/W0584.feature
|
213
|
+
features/code_check/W0599.feature
|
213
214
|
features/code_check/W0606.feature
|
214
215
|
features/code_check/W0635.feature
|
215
216
|
features/code_check/W0641.feature
|
data/NEWS
CHANGED
@@ -21,6 +21,29 @@
|
|
21
21
|
|
22
22
|
++
|
23
23
|
|
24
|
+
=== \AdLint 2.6.2 is released (2012-10-31)
|
25
|
+
|
26
|
+
==== Changes since the 2.6.0 release
|
27
|
+
|
28
|
+
* Fix compound-assignment-expression evaluation not to propagate initialization
|
29
|
+
status of the rhs operand
|
30
|
+
* Fix bad traits file parser in order to parse compound pathname strings
|
31
|
+
correctly on mswin
|
32
|
+
* Clarify W0082 message text by adding underlying type name of the operand
|
33
|
+
* Clarify W0578 and W0579 message texts by adding source and destination type
|
34
|
+
names of the conversion
|
35
|
+
* Clarify W0650 message text by adding lhs type name of the shift-expression
|
36
|
+
* Clarify W0719 message text by adding lhs underlying type name of the
|
37
|
+
shift-expression
|
38
|
+
* Clarify W1051 and W1052 message texts by adding type name of the arithmetic
|
39
|
+
expression
|
40
|
+
* Fix the interpreter to place sequence-point at the end of the
|
41
|
+
return-statement evaluation
|
42
|
+
|
43
|
+
See the file
|
44
|
+
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
45
|
+
for more details.
|
46
|
+
|
24
47
|
=== \AdLint 2.6.0 is released (2012-10-22)
|
25
48
|
|
26
49
|
==== Changes since the 2.4.10 release
|
@@ -36,10 +59,6 @@
|
|
36
59
|
* Clarify W9003 message text by adding destination type name of the implicit
|
37
60
|
conversion
|
38
61
|
|
39
|
-
See the file
|
40
|
-
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
41
|
-
for more details.
|
42
|
-
|
43
62
|
=== \AdLint 2.4.10 is released (2012-10-15)
|
44
63
|
|
45
64
|
==== Changes since the 2.4.6 release
|
data/README
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
\AdLint is a source code static analyzer.
|
27
27
|
|
28
|
-
It can point out
|
28
|
+
It can point out unreliable or nonportable code fragments, and can measure
|
29
29
|
various quality metrics of the source code.
|
30
30
|
|
31
31
|
It (currently) can analyze source code compliant with ANSI C89 / ISO C90 and
|
data/Rakefile
CHANGED
@@ -46,7 +46,7 @@ AdLint :: Advanced Lint - An open source and free source code static analyzer
|
|
46
46
|
EOS
|
47
47
|
s.description = <<EOS
|
48
48
|
AdLint is a source code static analyzer.
|
49
|
-
It can point out
|
49
|
+
It can point out unreliable or nonportable code fragments, and can measure various quality metrics of the source code.
|
50
50
|
It (currently) can analyze source code compliant with ANSI C89 / ISO C90 and partly ISO C99.
|
51
51
|
EOS
|
52
52
|
|
@@ -49,7 +49,7 @@
|
|
49
49
|
# - "ERR:X99"
|
50
50
|
# format: "Your custom message for the error of E9999."
|
51
51
|
|
52
|
-
version: "2.6.
|
52
|
+
version: "2.6.2"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -295,7 +295,7 @@ message_definition:
|
|
295
295
|
W0082:
|
296
296
|
classes:
|
297
297
|
- "UNC:X99"
|
298
|
-
format: "
|
298
|
+
format: "Unary operator `-' is applied to an operand whose underlying type `%s' is unsigned."
|
299
299
|
W0084:
|
300
300
|
classes:
|
301
301
|
- "UNC:X99"
|
@@ -1931,11 +1931,11 @@ message_definition:
|
|
1931
1931
|
W0578:
|
1932
1932
|
classes:
|
1933
1933
|
- "UNC:X99"
|
1934
|
-
format: "
|
1934
|
+
format: "A generic integer value of the compound expression typed `%s' is implicitly converted into a new value of bigger type `%s'."
|
1935
1935
|
W0579:
|
1936
1936
|
classes:
|
1937
1937
|
- "UNC:X99"
|
1938
|
-
format: "
|
1938
|
+
format: "A generic integer value of the compound expression typed `%s' is explicitly converted into a new value of bigger type `%s'."
|
1939
1939
|
W0580:
|
1940
1940
|
classes:
|
1941
1941
|
- "UNC:X99"
|
@@ -2131,7 +2131,7 @@ message_definition:
|
|
2131
2131
|
W0650:
|
2132
2132
|
classes:
|
2133
2133
|
- "UNC:X99"
|
2134
|
-
format: "A right operand
|
2134
|
+
format: "A value of the right operand in a shift expression is bigger than the bit size of the left operand type `%s'. This result is undefined."
|
2135
2135
|
W0653:
|
2136
2136
|
classes:
|
2137
2137
|
- "UNC:X99"
|
@@ -2379,7 +2379,7 @@ message_definition:
|
|
2379
2379
|
W0719:
|
2380
2380
|
classes:
|
2381
2381
|
- "UNC:X99"
|
2382
|
-
format: "A right operand
|
2382
|
+
format: "A value of the right operand in a shift expression is bigger than the bit size of the left operand underlying type `%s'."
|
2383
2383
|
W0720:
|
2384
2384
|
classes:
|
2385
2385
|
- "UNC:X99"
|
@@ -2875,11 +2875,11 @@ message_definition:
|
|
2875
2875
|
W1051:
|
2876
2876
|
classes:
|
2877
2877
|
- "UNC:X99"
|
2878
|
-
format: "The result of arithmetic
|
2878
|
+
format: "The result of unsigned arithmetic expression typed `%s' is going around 0 by overflow."
|
2879
2879
|
W1052:
|
2880
2880
|
classes:
|
2881
2881
|
- "UNC:X99"
|
2882
|
-
format: "The result of arithmetic
|
2882
|
+
format: "The result of unsigned arithmetic expression typed `%s' can be going around by overflow."
|
2883
2883
|
W1053:
|
2884
2884
|
classes:
|
2885
2885
|
- "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.6.
|
52
|
+
version: "2.6.2"
|
53
53
|
|
54
54
|
message_definition:
|
55
55
|
W0001:
|
@@ -295,7 +295,7 @@ message_definition:
|
|
295
295
|
W0082:
|
296
296
|
classes:
|
297
297
|
- "UNC:X99"
|
298
|
-
format: "単項演算子 `-'
|
298
|
+
format: "単項演算子 `-' を符号無しの潜在型 `%s' のオペランドに対して使っています。"
|
299
299
|
W0084:
|
300
300
|
classes:
|
301
301
|
- "UNC:X99"
|
@@ -1931,11 +1931,11 @@ message_definition:
|
|
1931
1931
|
W0578:
|
1932
1932
|
classes:
|
1933
1933
|
- "UNC:X99"
|
1934
|
-
format: "
|
1934
|
+
format: "暗黙的に汎整数型 `%s' の複合式からより大きな型 `%s' に型変換されています。"
|
1935
1935
|
W0579:
|
1936
1936
|
classes:
|
1937
1937
|
- "UNC:X99"
|
1938
|
-
format: "
|
1938
|
+
format: "汎整数型 `%s' の複合式を、より大きな型 `%s' にキャストしています。"
|
1939
1939
|
W0580:
|
1940
1940
|
classes:
|
1941
1941
|
- "UNC:X99"
|
@@ -2131,7 +2131,7 @@ message_definition:
|
|
2131
2131
|
W0650:
|
2132
2132
|
classes:
|
2133
2133
|
- "UNC:X99"
|
2134
|
-
format: "
|
2134
|
+
format: "シフト演算子の右オペランドの値が左オペランドの型 `%s' で表されるビット数に対して大きすぎます。結果は未定義になります。"
|
2135
2135
|
W0653:
|
2136
2136
|
classes:
|
2137
2137
|
- "UNC:X99"
|
@@ -2379,7 +2379,7 @@ message_definition:
|
|
2379
2379
|
W0719:
|
2380
2380
|
classes:
|
2381
2381
|
- "UNC:X99"
|
2382
|
-
format: "
|
2382
|
+
format: "シフト演算子の右オペランドが、潜在型 `%s' のビット幅以上の定数値です。"
|
2383
2383
|
W0720:
|
2384
2384
|
classes:
|
2385
2385
|
- "UNC:X99"
|
@@ -2875,11 +2875,11 @@ message_definition:
|
|
2875
2875
|
W1051:
|
2876
2876
|
classes:
|
2877
2877
|
- "UNC:X99"
|
2878
|
-
format: "
|
2878
|
+
format: "符号無し型 `%s' の算術演算結果は、桁あふれによって 0 を回り込みます。"
|
2879
2879
|
W1052:
|
2880
2880
|
classes:
|
2881
2881
|
- "UNC:X99"
|
2882
|
-
format: "
|
2882
|
+
format: "符号無し型 `%s' の算術演算結果は、桁あふれによって 0 を回り込むことがあります。"
|
2883
2883
|
W1053:
|
2884
2884
|
classes:
|
2885
2885
|
- "UNC:X99"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
Feature: W0599
|
2
|
+
|
3
|
+
W0599 detects that value of the variable is referred and updated between
|
4
|
+
sequence-points.
|
5
|
+
|
6
|
+
Scenario: return-expression in a for-statement
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
extern void bar(int, int, int);
|
10
|
+
|
11
|
+
static void foo(int a, int b, int *c)
|
12
|
+
{
|
13
|
+
b = (a + 1) + a++; /* W0599 */
|
14
|
+
b = c[a] + c[++a]; /* W0599 */
|
15
|
+
bar(a, a++, c[a]); /* W0599 */
|
16
|
+
bar(a, a, c[a++]); /* W0599 */
|
17
|
+
a = a + b;
|
18
|
+
c[a] = a++ + b; /* W0599 */
|
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
|
+
| W0118 | 1 | 13 |
|
25
|
+
| W1076 | 3 | 13 |
|
26
|
+
| W0723 | 5 | 12 |
|
27
|
+
| W0723 | 5 | 17 |
|
28
|
+
| W0599 | 5 | 7 |
|
29
|
+
| W0422 | 6 | 10 |
|
30
|
+
| W0422 | 6 | 17 |
|
31
|
+
| W0723 | 6 | 14 |
|
32
|
+
| W0599 | 6 | 7 |
|
33
|
+
| W0422 | 7 | 18 |
|
34
|
+
| W0599 | 7 | 8 |
|
35
|
+
| W0422 | 8 | 16 |
|
36
|
+
| W0723 | 9 | 11 |
|
37
|
+
| W0422 | 10 | 6 |
|
38
|
+
| W0723 | 10 | 16 |
|
39
|
+
| W0599 | 10 | 10 |
|
40
|
+
| W0104 | 3 | 36 |
|
41
|
+
| W0629 | 3 | 13 |
|
42
|
+
| W0512 | 5 | 20 |
|
43
|
+
| W0512 | 6 | 18 |
|
44
|
+
| W0512 | 7 | 13 |
|
45
|
+
| W0512 | 8 | 18 |
|
46
|
+
| W0512 | 10 | 13 |
|
47
|
+
| W0628 | 3 | 13 |
|
48
|
+
|
49
|
+
Scenario: return-expression in a for-statement
|
50
|
+
Given a target source named "fixture.c" with:
|
51
|
+
"""
|
52
|
+
static int foo(int x, int y, int z)
|
53
|
+
{
|
54
|
+
for (int i = 0; i < z; i++) { /* OK */
|
55
|
+
if (x < y) {
|
56
|
+
return i;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return 0;
|
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
|
+
| W0104 | 1 | 27 |
|
68
|
+
| W0104 | 1 | 34 |
|
69
|
+
| W1071 | 1 | 12 |
|
70
|
+
| W0629 | 1 | 12 |
|
71
|
+
| W0628 | 1 | 12 |
|