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
@@ -36,7 +36,7 @@
|
|
36
36
|
# X9999: "Your custom message for the fatal error of #9999."
|
37
37
|
# E9999: "Your custom message for the error of #9999."
|
38
38
|
|
39
|
-
version: "1.
|
39
|
+
version: "1.18.0"
|
40
40
|
|
41
41
|
message_definition:
|
42
42
|
X0001: "An unknown exception `%s' is found."
|
@@ -752,12 +752,12 @@ message_definition:
|
|
752
752
|
W1035: "`%s' declared typedef. It cannot be redeclared inside an inner scope without using explicit type."
|
753
753
|
W1036: "`%s' declared typedef. It cannot be redeclared as a member of structure or union without using explicit type."
|
754
754
|
W1037: "`%s' which has external coupling is declared more than one, this is incompatible."
|
755
|
-
W1039: "`ll' is used in conversion specifier."
|
755
|
+
W1039: "`ll' is used in %sth conversion specifier."
|
756
756
|
W1040: "An unrecognizable string is described after preprocessing directive."
|
757
757
|
W1041: "`%s' is not official preprocessing directive of ISO C standards."
|
758
758
|
W1042: "'sizeof' operator is using in preprocessing directive. This is the language extension."
|
759
759
|
W1043: "`@ address' is not supported ISO C standards. It will be considered as language extension."
|
760
|
-
W1044: "
|
760
|
+
W1044: "UNUSABLE"
|
761
761
|
W1045: "This `@ word' syntax will be ignored."
|
762
762
|
W1046: "A space character is ignored between `\\' and line feed."
|
763
763
|
W1047: "The struct, union or array's initializer is not literal."
|
@@ -36,7 +36,7 @@
|
|
36
36
|
# X9999: "Your custom message for the fatal error of #9999."
|
37
37
|
# E9999: "Your custom message for the error of #9999."
|
38
38
|
|
39
|
-
version: "1.
|
39
|
+
version: "1.18.0"
|
40
40
|
|
41
41
|
message_definition:
|
42
42
|
X0001: "不明な例外条件 `%s' を検出しました。"
|
@@ -752,12 +752,12 @@ message_definition:
|
|
752
752
|
W1035: "`%s' は typedef として宣言されています。明示的な型指定子を使わずに、より内側のスコープで再宣言することはできません。"
|
753
753
|
W1036: "`%s' は typedef として宣言されています。明示的な型指定子を使わずに、構造体または共用体のメンバとして再宣言することはできません。"
|
754
754
|
W1037: "外部結合をもつ `%s' が、二つ以上宣言されていますが互換性がありません。"
|
755
|
-
W1039: "
|
755
|
+
W1039: "%s 番目の変換指定子に `ll' が使われています。"
|
756
756
|
W1040: "前処理指令の後に認識できない文字列が記述されています。"
|
757
757
|
W1041: "`%s' は、ISO C 標準規格の正式な前処理指令ではありません。"
|
758
758
|
W1042: "前処理指令の中で sizeof 演算子を使っています。これは言語拡張です。"
|
759
759
|
W1043: "`@ address' は、ISO C 標準規格ではサポートされていません。言語拡張と見なします。"
|
760
|
-
W1044: "
|
760
|
+
W1044: "使用不可"
|
761
761
|
W1045: "この `@ word' 構文は無視されます。"
|
762
762
|
W1046: "`\\' と改行の間にある空白文字類が無視されています。"
|
763
763
|
W1047: "構造体、共用体、あるいは配列の初期化子がリテラルではありません。"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Feature: E0013
|
2
|
+
|
3
|
+
E0013 detects that an expression contains statements.
|
4
|
+
|
5
|
+
Scenario: statements in initializer
|
6
|
+
Given a target source named "E0013.c" with:
|
7
|
+
"""
|
8
|
+
int foo(int i)
|
9
|
+
{
|
10
|
+
int j = ({ volatile int *p = &i; i - 1; }); /* E0013 */
|
11
|
+
|
12
|
+
if (j == 0) {
|
13
|
+
return 0;
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
return foo(j);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
"""
|
20
|
+
When I successfully run `adlint E0013.c` on noarch
|
21
|
+
Then the output should exactly match with:
|
22
|
+
| mesg | line | column |
|
23
|
+
| E0013 | 3 | 13 |
|
24
|
+
| W0117 | 1 | 5 |
|
25
|
+
| W0556 | 9 | 19 |
|
26
|
+
| W0100 | 3 | 9 |
|
27
|
+
| W0031 | 1 | 13 |
|
28
|
+
| W0104 | 1 | 13 |
|
29
|
+
| W1071 | 1 | 5 |
|
30
|
+
| W0555 | 1 | 5 |
|
31
|
+
| W0589 | 1 | 5 |
|
32
|
+
| W0591 | 1 | 5 |
|
33
|
+
|
34
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -136,6 +136,7 @@ Feature: W0007
|
|
136
136
|
Then the output should exactly match with:
|
137
137
|
| mesg | line | column |
|
138
138
|
| W1076 | 1 | 12 |
|
139
|
+
| W1071 | 1 | 12 |
|
139
140
|
| W0629 | 1 | 12 |
|
140
141
|
| W0628 | 1 | 12 |
|
141
142
|
|
@@ -265,6 +266,7 @@ Feature: W0007
|
|
265
266
|
Then the output should exactly match with:
|
266
267
|
| mesg | line | column |
|
267
268
|
| W1076 | 1 | 12 |
|
269
|
+
| W1071 | 1 | 12 |
|
268
270
|
| W0629 | 1 | 12 |
|
269
271
|
| W0538 | 9 | 5 |
|
270
272
|
| W0628 | 1 | 12 |
|
@@ -17,8 +17,7 @@ Feature: W0583
|
|
17
17
|
}
|
18
18
|
"""
|
19
19
|
When I successfully run `adlint W0583.c` on noarch
|
20
|
-
Then the output should
|
21
|
-
And the output should exactly match with:
|
20
|
+
Then the output should exactly match with:
|
22
21
|
| mesg | line | column |
|
23
22
|
| W0109 | 4 | 15 |
|
24
23
|
| W0117 | 7 | 5 |
|
@@ -0,0 +1,132 @@
|
|
1
|
+
Feature: W0641
|
2
|
+
|
3
|
+
W0641 detects that an explicit conversion between variable of floating point
|
4
|
+
number and pointer to a variable is found.
|
5
|
+
|
6
|
+
Scenario: converting `float' into pointer to `int' variable
|
7
|
+
Given a target source named "W0641.c" with:
|
8
|
+
"""
|
9
|
+
int *foo(const float f)
|
10
|
+
{
|
11
|
+
return (int *) f; /* W0641 */
|
12
|
+
}
|
13
|
+
"""
|
14
|
+
When I successfully run `adlint W0641.c` on noarch
|
15
|
+
Then the output should exactly match with:
|
16
|
+
| mesg | line | column |
|
17
|
+
| W0117 | 1 | 6 |
|
18
|
+
| W0641 | 3 | 12 |
|
19
|
+
| W0628 | 1 | 6 |
|
20
|
+
|
21
|
+
Scenario: converting `double' into pointer to `int' variable
|
22
|
+
Given a target source named "W0641.c" with:
|
23
|
+
"""
|
24
|
+
int *foo(const double f)
|
25
|
+
{
|
26
|
+
return (int *) f; /* W0641 */
|
27
|
+
}
|
28
|
+
"""
|
29
|
+
When I successfully run `adlint W0641.c` on noarch
|
30
|
+
Then the output should exactly match with:
|
31
|
+
| mesg | line | column |
|
32
|
+
| W0117 | 1 | 6 |
|
33
|
+
| W0641 | 3 | 12 |
|
34
|
+
| W0628 | 1 | 6 |
|
35
|
+
|
36
|
+
Scenario: converting `long double' into pointer to `int' variable
|
37
|
+
Given a target source named "W0641.c" with:
|
38
|
+
"""
|
39
|
+
int *foo(const long double f)
|
40
|
+
{
|
41
|
+
return (int *) f; /* W0641 */
|
42
|
+
}
|
43
|
+
"""
|
44
|
+
When I successfully run `adlint W0641.c` on noarch
|
45
|
+
Then the output should exactly match with:
|
46
|
+
| mesg | line | column |
|
47
|
+
| W0117 | 1 | 6 |
|
48
|
+
| W0641 | 3 | 12 |
|
49
|
+
| W0628 | 1 | 6 |
|
50
|
+
|
51
|
+
Scenario: converting `int' into pointer to `float' variable
|
52
|
+
Given a target source named "W0641.c" with:
|
53
|
+
"""
|
54
|
+
float foo(int *p)
|
55
|
+
{
|
56
|
+
return (float) p; /* W0641 */
|
57
|
+
}
|
58
|
+
"""
|
59
|
+
When I successfully run `adlint W0641.c` on noarch
|
60
|
+
Then the output should exactly match with:
|
61
|
+
| mesg | line | column |
|
62
|
+
| W0117 | 1 | 7 |
|
63
|
+
| W0641 | 3 | 12 |
|
64
|
+
| W0104 | 1 | 16 |
|
65
|
+
| W0105 | 1 | 16 |
|
66
|
+
| W0628 | 1 | 7 |
|
67
|
+
|
68
|
+
Scenario: converting `int' into pointer to `double' variable
|
69
|
+
Given a target source named "W0641.c" with:
|
70
|
+
"""
|
71
|
+
double foo(int *p)
|
72
|
+
{
|
73
|
+
return (double) p; /* W0641 */
|
74
|
+
}
|
75
|
+
"""
|
76
|
+
When I successfully run `adlint W0641.c` on noarch
|
77
|
+
Then the output should exactly match with:
|
78
|
+
| mesg | line | column |
|
79
|
+
| W0117 | 1 | 8 |
|
80
|
+
| W0641 | 3 | 12 |
|
81
|
+
| W0104 | 1 | 17 |
|
82
|
+
| W0105 | 1 | 17 |
|
83
|
+
| W0628 | 1 | 8 |
|
84
|
+
|
85
|
+
Scenario: converting `int' into pointer to `long double'
|
86
|
+
Given a target source named "W0641.c" with:
|
87
|
+
"""
|
88
|
+
long double foo(int *p)
|
89
|
+
{
|
90
|
+
return (long double) p; /* W0641 */
|
91
|
+
}
|
92
|
+
"""
|
93
|
+
When I successfully run `adlint W0641.c` on noarch
|
94
|
+
Then the output should exactly match with:
|
95
|
+
| mesg | line | column |
|
96
|
+
| W0117 | 1 | 13 |
|
97
|
+
| W0641 | 3 | 12 |
|
98
|
+
| W0104 | 1 | 22 |
|
99
|
+
| W0105 | 1 | 22 |
|
100
|
+
| W0628 | 1 | 13 |
|
101
|
+
|
102
|
+
Scenario: converting `float' to `int'
|
103
|
+
Given a target source named "W0641.c" with:
|
104
|
+
"""
|
105
|
+
int foo(const float f)
|
106
|
+
{
|
107
|
+
return (int) f; /* OK */
|
108
|
+
}
|
109
|
+
"""
|
110
|
+
When I successfully run `adlint W0641.c` on noarch
|
111
|
+
Then the output should exactly match with:
|
112
|
+
| mesg | line | column |
|
113
|
+
| W0117 | 1 | 5 |
|
114
|
+
| W0628 | 1 | 5 |
|
115
|
+
|
116
|
+
Scenario: converting `float' into pointer to `void *'
|
117
|
+
Given a target source named "W0641.c" with:
|
118
|
+
"""
|
119
|
+
void *foo(float f)
|
120
|
+
{
|
121
|
+
return (void *) f; /* W0641 */
|
122
|
+
}
|
123
|
+
"""
|
124
|
+
When I successfully run `adlint W0641.c` on noarch
|
125
|
+
Then the output should exactly match with:
|
126
|
+
| mesg | line | column |
|
127
|
+
| W0117 | 1 | 7 |
|
128
|
+
| W0641 | 3 | 12 |
|
129
|
+
| W0104 | 1 | 17 |
|
130
|
+
| W0628 | 1 | 7 |
|
131
|
+
|
132
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -0,0 +1,529 @@
|
|
1
|
+
Feature: W0644
|
2
|
+
|
3
|
+
W0644 detects that an expression refers the value of a `void' expression.
|
4
|
+
|
5
|
+
Scenario: casting value of the `void' function
|
6
|
+
Given a target source named "W0644.c" with:
|
7
|
+
"""
|
8
|
+
extern void foo(void);
|
9
|
+
|
10
|
+
int bar(void)
|
11
|
+
{
|
12
|
+
return (int) foo(); /* W0644 */
|
13
|
+
}
|
14
|
+
"""
|
15
|
+
When I successfully run `adlint W0644.c` on noarch
|
16
|
+
Then the output should exactly match with:
|
17
|
+
| mesg | line | column |
|
18
|
+
| W0118 | 1 | 13 |
|
19
|
+
| W0117 | 3 | 5 |
|
20
|
+
| W0644 | 5 | 12 |
|
21
|
+
| W0628 | 3 | 5 |
|
22
|
+
|
23
|
+
Scenario: referring value of the `void' function in
|
24
|
+
array-subscript-expression
|
25
|
+
Given a target source named "W0644.c" with:
|
26
|
+
"""
|
27
|
+
extern void foo(void);
|
28
|
+
|
29
|
+
int bar(int a[])
|
30
|
+
{
|
31
|
+
return a[foo()]; /* W0644 */
|
32
|
+
}
|
33
|
+
"""
|
34
|
+
When I successfully run `adlint W0644.c` on noarch
|
35
|
+
Then the output should exactly match with:
|
36
|
+
| mesg | line | column |
|
37
|
+
| W0118 | 1 | 13 |
|
38
|
+
| W0117 | 3 | 5 |
|
39
|
+
| W0644 | 5 | 13 |
|
40
|
+
| W0104 | 3 | 13 |
|
41
|
+
| W0628 | 3 | 5 |
|
42
|
+
|
43
|
+
Scenario: referring value of the `void' function in function-call-expression
|
44
|
+
Given a target source named "W0644.c" with:
|
45
|
+
"""
|
46
|
+
extern void foo(void);
|
47
|
+
extern void bar(int);
|
48
|
+
|
49
|
+
void baz(void)
|
50
|
+
{
|
51
|
+
bar(foo()); /* W0644 */
|
52
|
+
}
|
53
|
+
"""
|
54
|
+
When I successfully run `adlint W0644.c` on noarch
|
55
|
+
Then the output should exactly match with:
|
56
|
+
| mesg | line | column |
|
57
|
+
| W0118 | 1 | 13 |
|
58
|
+
| W0118 | 2 | 13 |
|
59
|
+
| W0117 | 4 | 6 |
|
60
|
+
| W0644 | 6 | 12 |
|
61
|
+
| W1026 | 6 | 12 |
|
62
|
+
| W0628 | 4 | 6 |
|
63
|
+
|
64
|
+
Scenario: referring value of the `void' function in multiplicative-expression
|
65
|
+
Given a target source named "W0644.c" with:
|
66
|
+
"""
|
67
|
+
extern void foo(void);
|
68
|
+
|
69
|
+
int bar(int i)
|
70
|
+
{
|
71
|
+
return i * foo(); /* W0644 */
|
72
|
+
}
|
73
|
+
"""
|
74
|
+
When I successfully run `adlint W0644.c` on noarch
|
75
|
+
Then the output should exactly match with:
|
76
|
+
| mesg | line | column |
|
77
|
+
| W0118 | 1 | 13 |
|
78
|
+
| W0117 | 3 | 5 |
|
79
|
+
| W0644 | 5 | 14 |
|
80
|
+
| W0104 | 3 | 13 |
|
81
|
+
| W0628 | 3 | 5 |
|
82
|
+
|
83
|
+
Scenario: referring two values of the `void' function in
|
84
|
+
multiplicative-expression
|
85
|
+
Given a target source named "W0644.c" with:
|
86
|
+
"""
|
87
|
+
extern void foo(void);
|
88
|
+
|
89
|
+
int bar(void)
|
90
|
+
{
|
91
|
+
return foo() / foo(); /* W0644 */
|
92
|
+
}
|
93
|
+
"""
|
94
|
+
When I successfully run `adlint W0644.c` on noarch
|
95
|
+
Then the output should exactly match with:
|
96
|
+
| mesg | line | column |
|
97
|
+
| W0118 | 1 | 13 |
|
98
|
+
| W0117 | 3 | 5 |
|
99
|
+
| W0644 | 5 | 18 |
|
100
|
+
| W0628 | 3 | 5 |
|
101
|
+
|
102
|
+
Scenario: referring value of the `void' function in additive-expression
|
103
|
+
Given a target source named "W0644.c" with:
|
104
|
+
"""
|
105
|
+
extern void foo(void);
|
106
|
+
|
107
|
+
int bar(int i)
|
108
|
+
{
|
109
|
+
return i + foo(); /* W0644 */
|
110
|
+
}
|
111
|
+
"""
|
112
|
+
When I successfully run `adlint W0644.c` on noarch
|
113
|
+
Then the output should exactly match with:
|
114
|
+
| mesg | line | column |
|
115
|
+
| W0118 | 1 | 13 |
|
116
|
+
| W0117 | 3 | 5 |
|
117
|
+
| W0644 | 5 | 14 |
|
118
|
+
| W0104 | 3 | 13 |
|
119
|
+
| W0628 | 3 | 5 |
|
120
|
+
|
121
|
+
Scenario: referring two values of the `void' function in additive-expression
|
122
|
+
Given a target source named "W0644.c" with:
|
123
|
+
"""
|
124
|
+
extern void foo(void);
|
125
|
+
|
126
|
+
int bar(void)
|
127
|
+
{
|
128
|
+
return foo() + foo(); /* W0644 */
|
129
|
+
}
|
130
|
+
"""
|
131
|
+
When I successfully run `adlint W0644.c` on noarch
|
132
|
+
Then the output should exactly match with:
|
133
|
+
| mesg | line | column |
|
134
|
+
| W0118 | 1 | 13 |
|
135
|
+
| W0117 | 3 | 5 |
|
136
|
+
| W0644 | 5 | 18 |
|
137
|
+
| W0628 | 3 | 5 |
|
138
|
+
|
139
|
+
Scenario: referring value of the `void' function in shift-expression
|
140
|
+
Given a target source named "W0644.c" with:
|
141
|
+
"""
|
142
|
+
extern void foo(void);
|
143
|
+
|
144
|
+
int bar(int i)
|
145
|
+
{
|
146
|
+
return i << foo(); /* W0644 */
|
147
|
+
}
|
148
|
+
"""
|
149
|
+
When I successfully run `adlint W0644.c` on noarch
|
150
|
+
Then the output should exactly match with:
|
151
|
+
| mesg | line | column |
|
152
|
+
| W0118 | 1 | 13 |
|
153
|
+
| W0117 | 3 | 5 |
|
154
|
+
| W0644 | 5 | 14 |
|
155
|
+
| W0570 | 5 | 14 |
|
156
|
+
| W0572 | 5 | 14 |
|
157
|
+
| W0794 | 5 | 14 |
|
158
|
+
| W0104 | 3 | 13 |
|
159
|
+
| W0628 | 3 | 5 |
|
160
|
+
|
161
|
+
Scenario: referring two values of the `void' function in shift-expression
|
162
|
+
Given a target source named "W0644.c" with:
|
163
|
+
"""
|
164
|
+
extern void foo(void);
|
165
|
+
|
166
|
+
int bar(void)
|
167
|
+
{
|
168
|
+
return foo() << foo(); /* W0644 */
|
169
|
+
}
|
170
|
+
"""
|
171
|
+
When I successfully run `adlint W0644.c` on noarch
|
172
|
+
Then the output should exactly match with:
|
173
|
+
| mesg | line | column |
|
174
|
+
| W0118 | 1 | 13 |
|
175
|
+
| W0117 | 3 | 5 |
|
176
|
+
| W0644 | 5 | 18 |
|
177
|
+
| W0628 | 3 | 5 |
|
178
|
+
|
179
|
+
Scenario: referring value of the `void' function in relational-expression
|
180
|
+
Given a target source named "W0644.c" with:
|
181
|
+
"""
|
182
|
+
extern void foo(void);
|
183
|
+
|
184
|
+
int bar(int i)
|
185
|
+
{
|
186
|
+
return i < foo(); /* W0644 */
|
187
|
+
}
|
188
|
+
"""
|
189
|
+
When I successfully run `adlint W0644.c` on noarch
|
190
|
+
Then the output should exactly match with:
|
191
|
+
| mesg | line | column |
|
192
|
+
| W0118 | 1 | 13 |
|
193
|
+
| W0117 | 3 | 5 |
|
194
|
+
| W0644 | 5 | 14 |
|
195
|
+
| W0610 | 5 | 14 |
|
196
|
+
| W0104 | 3 | 13 |
|
197
|
+
| W0628 | 3 | 5 |
|
198
|
+
|
199
|
+
Scenario: referring two values of the `void' function in
|
200
|
+
relational-expression
|
201
|
+
Given a target source named "W0644.c" with:
|
202
|
+
"""
|
203
|
+
extern void foo(void);
|
204
|
+
|
205
|
+
int bar(void)
|
206
|
+
{
|
207
|
+
return foo() > foo(); /* W0644 */
|
208
|
+
}
|
209
|
+
"""
|
210
|
+
When I successfully run `adlint W0644.c` on noarch
|
211
|
+
Then the output should exactly match with:
|
212
|
+
| mesg | line | column |
|
213
|
+
| W0118 | 1 | 13 |
|
214
|
+
| W0117 | 3 | 5 |
|
215
|
+
| W0644 | 5 | 18 |
|
216
|
+
| W0628 | 3 | 5 |
|
217
|
+
|
218
|
+
Scenario: referring value of the `void' function in equality-expression
|
219
|
+
Given a target source named "W0644.c" with:
|
220
|
+
"""
|
221
|
+
extern void foo(void);
|
222
|
+
|
223
|
+
int bar(int i)
|
224
|
+
{
|
225
|
+
return i == foo(); /* W0644 */
|
226
|
+
}
|
227
|
+
"""
|
228
|
+
When I successfully run `adlint W0644.c` on noarch
|
229
|
+
Then the output should exactly match with:
|
230
|
+
| mesg | line | column |
|
231
|
+
| W0118 | 1 | 13 |
|
232
|
+
| W0117 | 3 | 5 |
|
233
|
+
| W0644 | 5 | 14 |
|
234
|
+
| W0104 | 3 | 13 |
|
235
|
+
| W0628 | 3 | 5 |
|
236
|
+
|
237
|
+
Scenario: referring two values of the `void' function in
|
238
|
+
relational-expression
|
239
|
+
Given a target source named "W0644.c" with:
|
240
|
+
"""
|
241
|
+
extern void foo(void);
|
242
|
+
|
243
|
+
int bar(void)
|
244
|
+
{
|
245
|
+
return foo() != foo(); /* W0644 */
|
246
|
+
}
|
247
|
+
"""
|
248
|
+
When I successfully run `adlint W0644.c` on noarch
|
249
|
+
Then the output should exactly match with:
|
250
|
+
| mesg | line | column |
|
251
|
+
| W0118 | 1 | 13 |
|
252
|
+
| W0117 | 3 | 5 |
|
253
|
+
| W0644 | 5 | 18 |
|
254
|
+
| W0628 | 3 | 5 |
|
255
|
+
|
256
|
+
Scenario: referring value of the `void' function in and-expression
|
257
|
+
Given a target source named "W0644.c" with:
|
258
|
+
"""
|
259
|
+
extern void foo(void);
|
260
|
+
|
261
|
+
int bar(int i)
|
262
|
+
{
|
263
|
+
return i & foo(); /* W0644 */
|
264
|
+
}
|
265
|
+
"""
|
266
|
+
When I successfully run `adlint W0644.c` on noarch
|
267
|
+
Then the output should exactly match with:
|
268
|
+
| mesg | line | column |
|
269
|
+
| W0118 | 1 | 13 |
|
270
|
+
| W0117 | 3 | 5 |
|
271
|
+
| W0644 | 5 | 14 |
|
272
|
+
| W0572 | 5 | 14 |
|
273
|
+
| W0104 | 3 | 13 |
|
274
|
+
| W0628 | 3 | 5 |
|
275
|
+
|
276
|
+
Scenario: referring two values of the `void' function in and-expression
|
277
|
+
Given a target source named "W0644.c" with:
|
278
|
+
"""
|
279
|
+
extern void foo(void);
|
280
|
+
|
281
|
+
int bar(void)
|
282
|
+
{
|
283
|
+
return foo() & foo(); /* W0644 */
|
284
|
+
}
|
285
|
+
"""
|
286
|
+
When I successfully run `adlint W0644.c` on noarch
|
287
|
+
Then the output should exactly match with:
|
288
|
+
| mesg | line | column |
|
289
|
+
| W0118 | 1 | 13 |
|
290
|
+
| W0117 | 3 | 5 |
|
291
|
+
| W0644 | 5 | 18 |
|
292
|
+
| W0628 | 3 | 5 |
|
293
|
+
|
294
|
+
Scenario: referring value of the `void' function in exclusive-or-expression
|
295
|
+
Given a target source named "W0644.c" with:
|
296
|
+
"""
|
297
|
+
extern void foo(void);
|
298
|
+
|
299
|
+
int bar(int i)
|
300
|
+
{
|
301
|
+
return i ^ foo(); /* W0644 */
|
302
|
+
}
|
303
|
+
"""
|
304
|
+
When I successfully run `adlint W0644.c` on noarch
|
305
|
+
Then the output should exactly match with:
|
306
|
+
| mesg | line | column |
|
307
|
+
| W0118 | 1 | 13 |
|
308
|
+
| W0117 | 3 | 5 |
|
309
|
+
| W0644 | 5 | 14 |
|
310
|
+
| W0572 | 5 | 14 |
|
311
|
+
| W0104 | 3 | 13 |
|
312
|
+
| W0628 | 3 | 5 |
|
313
|
+
|
314
|
+
Scenario: referring two values of the `void' function in
|
315
|
+
exclusive-or-expression
|
316
|
+
Given a target source named "W0644.c" with:
|
317
|
+
"""
|
318
|
+
extern void foo(void);
|
319
|
+
|
320
|
+
int bar(void)
|
321
|
+
{
|
322
|
+
return foo() ^ foo(); /* W0644 */
|
323
|
+
}
|
324
|
+
"""
|
325
|
+
When I successfully run `adlint W0644.c` on noarch
|
326
|
+
Then the output should exactly match with:
|
327
|
+
| mesg | line | column |
|
328
|
+
| W0118 | 1 | 13 |
|
329
|
+
| W0117 | 3 | 5 |
|
330
|
+
| W0644 | 5 | 18 |
|
331
|
+
| W0628 | 3 | 5 |
|
332
|
+
|
333
|
+
Scenario: referring value of the `void' function in inclusive-or-expression
|
334
|
+
Given a target source named "W0644.c" with:
|
335
|
+
"""
|
336
|
+
extern void foo(void);
|
337
|
+
|
338
|
+
int bar(int i)
|
339
|
+
{
|
340
|
+
return i | foo(); /* W0644 */
|
341
|
+
}
|
342
|
+
"""
|
343
|
+
When I successfully run `adlint W0644.c` on noarch
|
344
|
+
Then the output should exactly match with:
|
345
|
+
| mesg | line | column |
|
346
|
+
| W0118 | 1 | 13 |
|
347
|
+
| W0117 | 3 | 5 |
|
348
|
+
| W0644 | 5 | 14 |
|
349
|
+
| W0572 | 5 | 14 |
|
350
|
+
| W0104 | 3 | 13 |
|
351
|
+
| W0628 | 3 | 5 |
|
352
|
+
|
353
|
+
Scenario: referring two values of the `void' function in
|
354
|
+
inclusive-or-expression
|
355
|
+
Given a target source named "W0644.c" with:
|
356
|
+
"""
|
357
|
+
extern void foo(void);
|
358
|
+
|
359
|
+
int bar(void)
|
360
|
+
{
|
361
|
+
return foo() | foo(); /* W0644 */
|
362
|
+
}
|
363
|
+
"""
|
364
|
+
When I successfully run `adlint W0644.c` on noarch
|
365
|
+
Then the output should exactly match with:
|
366
|
+
| mesg | line | column |
|
367
|
+
| W0118 | 1 | 13 |
|
368
|
+
| W0117 | 3 | 5 |
|
369
|
+
| W0644 | 5 | 18 |
|
370
|
+
| W0628 | 3 | 5 |
|
371
|
+
|
372
|
+
Scenario: referring value of the `void' function in logical-and-expression
|
373
|
+
Given a target source named "W0644.c" with:
|
374
|
+
"""
|
375
|
+
extern void foo(void);
|
376
|
+
|
377
|
+
int bar(int i)
|
378
|
+
{
|
379
|
+
if (i && foo()) { /* W0644 */
|
380
|
+
return 0;
|
381
|
+
}
|
382
|
+
|
383
|
+
return i && foo(); /* W0644 */
|
384
|
+
}
|
385
|
+
"""
|
386
|
+
When I successfully run `adlint W0644.c` on noarch
|
387
|
+
Then the output should exactly match with:
|
388
|
+
| mesg | line | column |
|
389
|
+
| W0118 | 1 | 13 |
|
390
|
+
| W0117 | 3 | 5 |
|
391
|
+
| W0644 | 5 | 11 |
|
392
|
+
| W0644 | 9 | 14 |
|
393
|
+
| W0035 | 9 | 14 |
|
394
|
+
| W0104 | 3 | 13 |
|
395
|
+
| W1071 | 3 | 5 |
|
396
|
+
| W0488 | 5 | 9 |
|
397
|
+
| W0508 | 5 | 11 |
|
398
|
+
| W0488 | 9 | 12 |
|
399
|
+
| W0508 | 9 | 14 |
|
400
|
+
| W0628 | 3 | 5 |
|
401
|
+
|
402
|
+
Scenario: referring two values of the `void' function in
|
403
|
+
exclusive-or-expression
|
404
|
+
Given a target source named "W0644.c" with:
|
405
|
+
"""
|
406
|
+
extern void foo(void);
|
407
|
+
|
408
|
+
int bar(void)
|
409
|
+
{
|
410
|
+
if (foo() && foo()) { /* W0644 */
|
411
|
+
return 0;
|
412
|
+
}
|
413
|
+
|
414
|
+
return foo() && foo(); /* W0644 */
|
415
|
+
}
|
416
|
+
"""
|
417
|
+
When I successfully run `adlint W0644.c` on noarch
|
418
|
+
Then the output should exactly match with:
|
419
|
+
| mesg | line | column |
|
420
|
+
| W0118 | 1 | 13 |
|
421
|
+
| W0117 | 3 | 5 |
|
422
|
+
| W0644 | 5 | 15 |
|
423
|
+
| W0644 | 9 | 18 |
|
424
|
+
| W0035 | 9 | 18 |
|
425
|
+
| W1071 | 3 | 5 |
|
426
|
+
| W0488 | 5 | 9 |
|
427
|
+
| W0508 | 5 | 15 |
|
428
|
+
| W0488 | 9 | 12 |
|
429
|
+
| W0508 | 9 | 18 |
|
430
|
+
| W0628 | 3 | 5 |
|
431
|
+
|
432
|
+
Scenario: referring value of the `void' function in logical-or-expression
|
433
|
+
Given a target source named "W0644.c" with:
|
434
|
+
"""
|
435
|
+
extern void foo(void);
|
436
|
+
|
437
|
+
int bar(int i)
|
438
|
+
{
|
439
|
+
if (i || foo()) { /* W0644 */
|
440
|
+
return 0;
|
441
|
+
}
|
442
|
+
|
443
|
+
return i || foo(); /* W0644 */
|
444
|
+
}
|
445
|
+
"""
|
446
|
+
When I successfully run `adlint W0644.c` on noarch
|
447
|
+
Then the output should exactly match with:
|
448
|
+
| mesg | line | column |
|
449
|
+
| W0118 | 1 | 13 |
|
450
|
+
| W0117 | 3 | 5 |
|
451
|
+
| W0644 | 5 | 11 |
|
452
|
+
| W0644 | 9 | 14 |
|
453
|
+
| W0035 | 9 | 14 |
|
454
|
+
| W0104 | 3 | 13 |
|
455
|
+
| W1071 | 3 | 5 |
|
456
|
+
| W0488 | 5 | 9 |
|
457
|
+
| W0508 | 5 | 11 |
|
458
|
+
| W0488 | 9 | 12 |
|
459
|
+
| W0508 | 9 | 14 |
|
460
|
+
| W0628 | 3 | 5 |
|
461
|
+
|
462
|
+
Scenario: referring two values of the `void' function in
|
463
|
+
exclusive-or-expression
|
464
|
+
Given a target source named "W0644.c" with:
|
465
|
+
"""
|
466
|
+
extern void foo(void);
|
467
|
+
|
468
|
+
int bar(void)
|
469
|
+
{
|
470
|
+
if (foo() || foo()) { /* W0644 */
|
471
|
+
return 0;
|
472
|
+
}
|
473
|
+
|
474
|
+
return foo() || foo(); /* W0644 */
|
475
|
+
}
|
476
|
+
"""
|
477
|
+
When I successfully run `adlint W0644.c` on noarch
|
478
|
+
Then the output should exactly match with:
|
479
|
+
| mesg | line | column |
|
480
|
+
| W0118 | 1 | 13 |
|
481
|
+
| W0117 | 3 | 5 |
|
482
|
+
| W0644 | 5 | 15 |
|
483
|
+
| W0644 | 9 | 18 |
|
484
|
+
| W0035 | 9 | 18 |
|
485
|
+
| W1071 | 3 | 5 |
|
486
|
+
| W0488 | 5 | 9 |
|
487
|
+
| W0508 | 5 | 15 |
|
488
|
+
| W0488 | 9 | 12 |
|
489
|
+
| W0508 | 9 | 18 |
|
490
|
+
| W0628 | 3 | 5 |
|
491
|
+
|
492
|
+
Scenario: referring value of the `void' function in assignment-expression
|
493
|
+
Given a target source named "W0644.c" with:
|
494
|
+
"""
|
495
|
+
extern void foo(void);
|
496
|
+
|
497
|
+
void bar(int i)
|
498
|
+
{
|
499
|
+
i = foo(); /* W0644 */
|
500
|
+
}
|
501
|
+
"""
|
502
|
+
When I successfully run `adlint W0644.c` on noarch
|
503
|
+
Then the output should exactly match with:
|
504
|
+
| mesg | line | column |
|
505
|
+
| W0118 | 1 | 13 |
|
506
|
+
| W0117 | 3 | 6 |
|
507
|
+
| W0644 | 5 | 7 |
|
508
|
+
| W0628 | 3 | 6 |
|
509
|
+
|
510
|
+
Scenario: referring value of the `void' function in
|
511
|
+
compound-assignment-expression
|
512
|
+
Given a target source named "W0644.c" with:
|
513
|
+
"""
|
514
|
+
extern void foo(void);
|
515
|
+
|
516
|
+
void bar(int i)
|
517
|
+
{
|
518
|
+
i += foo(); /* W0644 */
|
519
|
+
}
|
520
|
+
"""
|
521
|
+
When I successfully run `adlint W0644.c` on noarch
|
522
|
+
Then the output should exactly match with:
|
523
|
+
| mesg | line | column |
|
524
|
+
| W0118 | 1 | 13 |
|
525
|
+
| W0117 | 3 | 6 |
|
526
|
+
| W0644 | 5 | 7 |
|
527
|
+
| W0628 | 3 | 6 |
|
528
|
+
|
529
|
+
# vim:ts=2:sw=2:sts=2:et:
|