adlint 1.14.0 → 1.16.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 +265 -0
- data/MANIFEST +15 -0
- data/NEWS +30 -4
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/mesg.d/en_US/messages.yml +3 -3
- data/etc/mesg.d/ja_JP/messages.yml +3 -3
- data/features/message_detection/W0001.feature +2 -0
- data/features/message_detection/W0007.feature +8 -0
- data/features/message_detection/W0010.feature +4 -1
- data/features/message_detection/W0013.feature +8 -0
- data/features/message_detection/W0093.feature +3 -0
- data/features/message_detection/W0104.feature +7 -0
- data/features/message_detection/W0643.feature +80 -0
- data/features/message_detection/W0646.feature +115 -0
- data/features/message_detection/W0691.feature +100 -0
- data/features/message_detection/W0692.feature +32 -0
- data/features/message_detection/W0694.feature +128 -0
- data/features/message_detection/W0716.feature +3 -0
- data/features/message_detection/W0717.feature +3 -0
- data/features/message_detection/W0718.feature +3 -0
- data/features/message_detection/W0723.feature +2 -0
- data/features/message_detection/W0732.feature +3 -0
- data/features/message_detection/W0733.feature +3 -0
- data/features/message_detection/W0734.feature +8 -0
- data/features/message_detection/W0735.feature +8 -0
- data/features/message_detection/W0805.feature +92 -0
- data/features/message_detection/W0811.feature +79 -0
- data/features/message_detection/W1031.feature +7 -0
- data/features/message_detection/W1040.feature +89 -0
- data/features/message_detection/W1041.feature +15 -0
- data/features/message_detection/W1046.feature +60 -0
- data/features/message_detection/W1052.feature +3 -0
- data/features/message_detection/W1066.feature +3 -0
- data/features/message_detection/W1067.feature +3 -0
- data/features/message_detection/W1068.feature +3 -0
- data/features/message_detection/W1069.feature +5 -0
- data/features/message_detection/W1070.feature +6 -0
- data/features/message_detection/W1072.feature +1 -0
- data/features/message_detection/W1073.feature +145 -0
- data/features/message_detection/W1074.feature +139 -0
- data/features/message_detection/W1075.feature +86 -0
- data/features/message_detection/W1076.feature +66 -0
- data/features/message_detection/W1077.feature +105 -0
- data/features/message_detection/W9003.feature +4 -0
- data/lib/adlint/c/ctrlexpr.rb +3 -0
- data/lib/adlint/c/interp.rb +11 -5
- data/lib/adlint/c/lexer.rb +14 -3
- data/lib/adlint/c/message.rb +192 -0
- data/lib/adlint/c/parser.rb +19 -3
- data/lib/adlint/c/parser.y +18 -2
- data/lib/adlint/c/phase.rb +19 -6
- data/lib/adlint/c/syntax.rb +6 -0
- data/lib/adlint/c/type.rb +5 -1
- data/lib/adlint/cpp/constexpr.rb +3 -3
- data/lib/adlint/cpp/constexpr.y +3 -3
- data/lib/adlint/cpp/eval.rb +60 -86
- data/lib/adlint/cpp/lexer.rb +82 -28
- data/lib/adlint/cpp/macro.rb +64 -35
- data/lib/adlint/cpp/message.rb +137 -4
- data/lib/adlint/cpp/phase.rb +8 -0
- data/lib/adlint/cpp/syntax.rb +25 -0
- data/lib/adlint/lang.rb +2 -1
- 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 +102 -85
- data/share/doc/users_guide_en.texi +85 -69
- data/share/doc/users_guide_ja.html +102 -94
- data/share/doc/users_guide_ja.texi +85 -77
- metadata +17 -2
@@ -13,7 +13,7 @@ Feature: W0010
|
|
13
13
|
When I successfully run `adlint W0010.c` on noarch
|
14
14
|
Then the output should exactly match with:
|
15
15
|
| mesg | line | column |
|
16
|
-
|
|
16
|
+
| W1076 | 1 | 12 |
|
17
17
|
| W0104 | 1 | 20 |
|
18
18
|
| W0629 | 1 | 12 |
|
19
19
|
| W0010 | 3 | 20 |
|
@@ -30,6 +30,7 @@ Feature: W0010
|
|
30
30
|
When I successfully run `adlint W0010.c` on noarch
|
31
31
|
Then the output should exactly match with:
|
32
32
|
| mesg | line | column |
|
33
|
+
| W1076 | 1 | 12 |
|
33
34
|
| W0104 | 1 | 20 |
|
34
35
|
| W0629 | 1 | 12 |
|
35
36
|
| W0010 | 3 | 20 |
|
@@ -47,6 +48,7 @@ Feature: W0010
|
|
47
48
|
When I successfully run `adlint W0010.c` on noarch
|
48
49
|
Then the output should exactly match with:
|
49
50
|
| mesg | line | column |
|
51
|
+
| W1076 | 1 | 12 |
|
50
52
|
| W0556 | 3 | 25 |
|
51
53
|
| W0104 | 1 | 20 |
|
52
54
|
| W0104 | 1 | 27 |
|
@@ -65,6 +67,7 @@ Feature: W0010
|
|
65
67
|
When I successfully run `adlint W0010.c` on noarch
|
66
68
|
Then the output should exactly match with:
|
67
69
|
| mesg | line | column |
|
70
|
+
| W1076 | 1 | 12 |
|
68
71
|
| W0723 | 3 | 32 |
|
69
72
|
| W0104 | 1 | 20 |
|
70
73
|
| W0104 | 1 | 27 |
|
@@ -21,6 +21,7 @@ Feature: W0013
|
|
21
21
|
When I successfully run `adlint W0013.c` on noarch
|
22
22
|
Then the output should exactly match with:
|
23
23
|
| mesg | line | column |
|
24
|
+
| W1076 | 1 | 13 |
|
24
25
|
| W0629 | 1 | 13 |
|
25
26
|
| W0535 | 6 | 10 |
|
26
27
|
| W0013 | 9 | 13 |
|
@@ -44,6 +45,7 @@ Feature: W0013
|
|
44
45
|
When I successfully run `adlint W0013.c` on noarch
|
45
46
|
Then the output should exactly match with:
|
46
47
|
| mesg | line | column |
|
48
|
+
| W1076 | 1 | 13 |
|
47
49
|
| W0629 | 1 | 13 |
|
48
50
|
| W0013 | 8 | 13 |
|
49
51
|
| W0628 | 1 | 13 |
|
@@ -68,6 +70,7 @@ Feature: W0013
|
|
68
70
|
When I successfully run `adlint W0013.c` on noarch
|
69
71
|
Then the output should exactly match with:
|
70
72
|
| mesg | line | column |
|
73
|
+
| W1076 | 1 | 13 |
|
71
74
|
| W0629 | 1 | 13 |
|
72
75
|
| W0013 | 10 | 13 |
|
73
76
|
| W0628 | 1 | 13 |
|
@@ -92,6 +95,7 @@ Feature: W0013
|
|
92
95
|
When I successfully run `adlint W0013.c` on noarch
|
93
96
|
Then the output should exactly match with:
|
94
97
|
| mesg | line | column |
|
98
|
+
| W1076 | 1 | 13 |
|
95
99
|
| W0629 | 1 | 13 |
|
96
100
|
| W0013 | 10 | 13 |
|
97
101
|
| W0628 | 1 | 13 |
|
@@ -115,6 +119,7 @@ Feature: W0013
|
|
115
119
|
When I successfully run `adlint W0013.c` on noarch
|
116
120
|
Then the output should exactly match with:
|
117
121
|
| mesg | line | column |
|
122
|
+
| W1076 | 1 | 13 |
|
118
123
|
| W0629 | 1 | 13 |
|
119
124
|
| W0535 | 6 | 10 |
|
120
125
|
| W0628 | 1 | 13 |
|
@@ -137,6 +142,7 @@ Feature: W0013
|
|
137
142
|
When I successfully run `adlint W0013.c` on noarch
|
138
143
|
Then the output should exactly match with:
|
139
144
|
| mesg | line | column |
|
145
|
+
| W1076 | 1 | 13 |
|
140
146
|
| W0629 | 1 | 13 |
|
141
147
|
| W0628 | 1 | 13 |
|
142
148
|
|
@@ -160,6 +166,7 @@ Feature: W0013
|
|
160
166
|
When I successfully run `adlint W0013.c` on noarch
|
161
167
|
Then the output should exactly match with:
|
162
168
|
| mesg | line | column |
|
169
|
+
| W1076 | 1 | 13 |
|
163
170
|
| W0629 | 1 | 13 |
|
164
171
|
| W0628 | 1 | 13 |
|
165
172
|
|
@@ -183,6 +190,7 @@ Feature: W0013
|
|
183
190
|
When I successfully run `adlint W0013.c` on noarch
|
184
191
|
Then the output should exactly match with:
|
185
192
|
| mesg | line | column |
|
193
|
+
| W1076 | 1 | 13 |
|
186
194
|
| W0629 | 1 | 13 |
|
187
195
|
| W0628 | 1 | 13 |
|
188
196
|
|
@@ -25,6 +25,7 @@ Feature: W0093
|
|
25
25
|
When I successfully run `adlint W0093.c` on noarch
|
26
26
|
Then the output should exactly match with:
|
27
27
|
| mesg | line | column |
|
28
|
+
| W1076 | 1 | 13 |
|
28
29
|
| W0093 | 8 | 23 |
|
29
30
|
| W0093 | 11 | 23 |
|
30
31
|
| W0629 | 1 | 13 |
|
@@ -53,6 +54,7 @@ Feature: W0093
|
|
53
54
|
When I successfully run `adlint W0093.c` on noarch
|
54
55
|
Then the output should exactly match with:
|
55
56
|
| mesg | line | column |
|
57
|
+
| W1076 | 1 | 13 |
|
56
58
|
| W0093 | 11 | 23 |
|
57
59
|
| W0629 | 1 | 13 |
|
58
60
|
| W0628 | 1 | 13 |
|
@@ -80,6 +82,7 @@ Feature: W0093
|
|
80
82
|
When I successfully run `adlint W0093.c` on noarch
|
81
83
|
Then the output should exactly match with:
|
82
84
|
| mesg | line | column |
|
85
|
+
| W1076 | 1 | 13 |
|
83
86
|
| W0093 | 8 | 23 |
|
84
87
|
| W0629 | 1 | 13 |
|
85
88
|
| W0628 | 1 | 13 |
|
@@ -13,6 +13,7 @@ Feature: W0104
|
|
13
13
|
When I successfully run `adlint W0104.c` on noarch
|
14
14
|
Then the output should exactly match with:
|
15
15
|
| mesg | line | column |
|
16
|
+
| W1076 | 1 | 12 |
|
16
17
|
| W0723 | 3 | 14 |
|
17
18
|
| W0104 | 1 | 21 |
|
18
19
|
| W0629 | 1 | 12 |
|
@@ -29,6 +30,7 @@ Feature: W0104
|
|
29
30
|
When I successfully run `adlint W0104.c` on noarch
|
30
31
|
Then the output should exactly match with:
|
31
32
|
| mesg | line | column |
|
33
|
+
| W1076 | 1 | 12 |
|
32
34
|
| W0723 | 3 | 14 |
|
33
35
|
| W0629 | 1 | 12 |
|
34
36
|
| W0628 | 1 | 12 |
|
@@ -44,6 +46,7 @@ Feature: W0104
|
|
44
46
|
When I successfully run `adlint W0104.c` on noarch
|
45
47
|
Then the output should exactly match with:
|
46
48
|
| mesg | line | column |
|
49
|
+
| W1076 | 1 | 12 |
|
47
50
|
| W0723 | 3 | 14 |
|
48
51
|
| W0629 | 1 | 12 |
|
49
52
|
| W0628 | 1 | 12 |
|
@@ -59,6 +62,7 @@ Feature: W0104
|
|
59
62
|
When I successfully run `adlint W0104.c` on noarch
|
60
63
|
Then the output should exactly match with:
|
61
64
|
| mesg | line | column |
|
65
|
+
| W1076 | 1 | 12 |
|
62
66
|
| W0723 | 3 | 14 |
|
63
67
|
| W0629 | 1 | 12 |
|
64
68
|
| W0628 | 1 | 12 |
|
@@ -74,6 +78,7 @@ Feature: W0104
|
|
74
78
|
When I successfully run `adlint W0104.c` on noarch
|
75
79
|
Then the output should exactly match with:
|
76
80
|
| mesg | line | column |
|
81
|
+
| W1076 | 1 | 12 |
|
77
82
|
| W0723 | 3 | 14 |
|
78
83
|
| W0629 | 1 | 12 |
|
79
84
|
| W0628 | 1 | 12 |
|
@@ -89,6 +94,7 @@ Feature: W0104
|
|
89
94
|
When I successfully run `adlint W0104.c` on noarch
|
90
95
|
Then the output should exactly match with:
|
91
96
|
| mesg | line | column |
|
97
|
+
| W1076 | 1 | 12 |
|
92
98
|
| W0723 | 3 | 14 |
|
93
99
|
| W0629 | 1 | 12 |
|
94
100
|
| W0628 | 1 | 12 |
|
@@ -104,6 +110,7 @@ Feature: W0104
|
|
104
110
|
When I successfully run `adlint W0104.c` on noarch
|
105
111
|
Then the output should exactly match with:
|
106
112
|
| mesg | line | column |
|
113
|
+
| W1076 | 1 | 12 |
|
107
114
|
| W0723 | 3 | 14 |
|
108
115
|
| W0629 | 1 | 12 |
|
109
116
|
| W0628 | 1 | 12 |
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Feature: W0643
|
2
|
+
|
3
|
+
W0643 detects that the last backslash of argument tokens will confuse the `#'
|
4
|
+
operator in the function-like macro.
|
5
|
+
|
6
|
+
Scenario: one backslash
|
7
|
+
Given a target source named "W0643.c" with:
|
8
|
+
"""
|
9
|
+
#define MACRO(x) #x
|
10
|
+
const char *str = MACRO(foo\); /* W0643 */
|
11
|
+
"""
|
12
|
+
When I successfully run `adlint W0643.c` on noarch
|
13
|
+
Then the output should exactly match with:
|
14
|
+
| mesg | line | column |
|
15
|
+
| W0442 | 1 | 1 |
|
16
|
+
| W0643 | 2 | 28 |
|
17
|
+
| W0117 | 2 | 13 |
|
18
|
+
|
19
|
+
Scenario: two backslashes
|
20
|
+
Given a target source named "W0643.c" with:
|
21
|
+
"""
|
22
|
+
#define MACRO(x) #x
|
23
|
+
const char *str = MACRO(foo\\); /* OK */
|
24
|
+
"""
|
25
|
+
When I successfully run `adlint W0643.c` on noarch
|
26
|
+
Then the output should exactly match with:
|
27
|
+
| mesg | line | column |
|
28
|
+
| W0442 | 1 | 1 |
|
29
|
+
| W0117 | 2 | 13 |
|
30
|
+
|
31
|
+
Scenario: three backslashes
|
32
|
+
Given a target source named "W0643.c" with:
|
33
|
+
"""
|
34
|
+
#define MACRO(x) #x
|
35
|
+
const char *str = MACRO(foo\\\); /* W0643 */
|
36
|
+
"""
|
37
|
+
When I successfully run `adlint W0643.c` on noarch
|
38
|
+
Then the output should exactly match with:
|
39
|
+
| mesg | line | column |
|
40
|
+
| W0442 | 1 | 1 |
|
41
|
+
| W0643 | 2 | 30 |
|
42
|
+
| W0117 | 2 | 13 |
|
43
|
+
|
44
|
+
Scenario: four backslashes
|
45
|
+
Given a target source named "W0643.c" with:
|
46
|
+
"""
|
47
|
+
#define MACRO(x) #x
|
48
|
+
const char *str = MACRO(foo\\\\); /* OK */
|
49
|
+
"""
|
50
|
+
When I successfully run `adlint W0643.c` on noarch
|
51
|
+
Then the output should exactly match with:
|
52
|
+
| mesg | line | column |
|
53
|
+
| W0442 | 1 | 1 |
|
54
|
+
| W0117 | 2 | 13 |
|
55
|
+
|
56
|
+
Scenario: no backslashes
|
57
|
+
Given a target source named "W0643.c" with:
|
58
|
+
"""
|
59
|
+
#define MACRO(x) #x
|
60
|
+
const char *str = MACRO(foo); /* OK */
|
61
|
+
"""
|
62
|
+
When I successfully run `adlint W0643.c` on noarch
|
63
|
+
Then the output should exactly match with:
|
64
|
+
| mesg | line | column |
|
65
|
+
| W0442 | 1 | 1 |
|
66
|
+
| W0117 | 2 | 13 |
|
67
|
+
|
68
|
+
Scenario: backslashes middle of argument tokens
|
69
|
+
Given a target source named "W0643.c" with:
|
70
|
+
"""
|
71
|
+
#define MACRO(x) #x
|
72
|
+
const char *str = MACRO(foo \ bar \\ baz); /* OK */
|
73
|
+
"""
|
74
|
+
When I successfully run `adlint W0643.c` on noarch
|
75
|
+
Then the output should exactly match with:
|
76
|
+
| mesg | line | column |
|
77
|
+
| W0442 | 1 | 1 |
|
78
|
+
| W0117 | 2 | 13 |
|
79
|
+
|
80
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -0,0 +1,115 @@
|
|
1
|
+
Feature: W0646
|
2
|
+
|
3
|
+
W0646 detects that a string-literal of narrow characters and a string-literal
|
4
|
+
of wide characters are neighboring.
|
5
|
+
|
6
|
+
Scenario: a string-literal of narrow characters followed by one of wide
|
7
|
+
characters
|
8
|
+
Given a target source named "W0646.c" with:
|
9
|
+
"""
|
10
|
+
static const char *str = "foo" L"bar"; /* W0646 */
|
11
|
+
"""
|
12
|
+
When I successfully run `adlint W0646.c` on noarch
|
13
|
+
Then the output should exactly match with:
|
14
|
+
| mesg | line | column |
|
15
|
+
| W0646 | 1 | 32 |
|
16
|
+
| W0947 | 1 | 26 |
|
17
|
+
|
18
|
+
Scenario: a string-literal of narrow characters followed by a compatible
|
19
|
+
string-literal
|
20
|
+
Given a target source named "W0646.c" with:
|
21
|
+
"""
|
22
|
+
static const char *str = "foo" "bar"; /* OK */
|
23
|
+
"""
|
24
|
+
When I successfully run `adlint W0646.c` on noarch
|
25
|
+
Then the output should exactly match with:
|
26
|
+
| mesg | line | column |
|
27
|
+
| W0947 | 1 | 26 |
|
28
|
+
|
29
|
+
Scenario: a string-literal of wide characters followed by one of narrow
|
30
|
+
characters
|
31
|
+
Given a target source named "W0646.c" with:
|
32
|
+
"""
|
33
|
+
static const char *str = L"foo" "bar"; /* W0646 */
|
34
|
+
"""
|
35
|
+
When I successfully run `adlint W0646.c` on noarch
|
36
|
+
Then the output should exactly match with:
|
37
|
+
| mesg | line | column |
|
38
|
+
| W0646 | 1 | 33 |
|
39
|
+
| W9003 | 1 | 26 |
|
40
|
+
| W0626 | 1 | 26 |
|
41
|
+
| W0947 | 1 | 26 |
|
42
|
+
|
43
|
+
Scenario: a string-literal of wide characters followed by a compatible
|
44
|
+
string-literal
|
45
|
+
Given a target source named "W0646.c" with:
|
46
|
+
"""
|
47
|
+
static const char *str = L"foo" L"bar"; /* OK */
|
48
|
+
"""
|
49
|
+
When I successfully run `adlint W0646.c` on noarch
|
50
|
+
Then the output should exactly match with:
|
51
|
+
| mesg | line | column |
|
52
|
+
| W9003 | 1 | 26 |
|
53
|
+
| W0626 | 1 | 26 |
|
54
|
+
| W0947 | 1 | 26 |
|
55
|
+
|
56
|
+
Scenario: a string-literal of narrow characters followed by one of wide
|
57
|
+
characters those are replaced by macros
|
58
|
+
Given a target source named "W0646.c" with:
|
59
|
+
"""
|
60
|
+
#define STR1 "foo"
|
61
|
+
#define STR2 L"bar"
|
62
|
+
|
63
|
+
static const char *str = STR1 STR2; /* W0646 */
|
64
|
+
"""
|
65
|
+
When I successfully run `adlint W0646.c` on noarch
|
66
|
+
Then the output should exactly match with:
|
67
|
+
| mesg | line | column |
|
68
|
+
| W0646 | 4 | 31 |
|
69
|
+
|
70
|
+
Scenario: a string-literal of narrow characters followed by a compatible
|
71
|
+
string-literal those are replaced by macros
|
72
|
+
Given a target source named "W0646.c" with:
|
73
|
+
"""
|
74
|
+
#define STR1 "foo"
|
75
|
+
#define STR2 "bar"
|
76
|
+
|
77
|
+
static const char *str = STR1 STR2; /* OK */
|
78
|
+
"""
|
79
|
+
When I successfully run `adlint W0646.c` on noarch
|
80
|
+
Then the output should exactly match with:
|
81
|
+
| mesg | line | column |
|
82
|
+
| W0947 | 1 | 26 |
|
83
|
+
|
84
|
+
Scenario: a string-literal of wide characters followed by one of narrow
|
85
|
+
characters those are replaced by macros
|
86
|
+
Given a target source named "W0646.c" with:
|
87
|
+
"""
|
88
|
+
#define STR1 L"foo"
|
89
|
+
#define STR2 "bar"
|
90
|
+
|
91
|
+
static const char *str = STR1 STR2; /* W0646 */
|
92
|
+
"""
|
93
|
+
When I successfully run `adlint W0646.c` on noarch
|
94
|
+
Then the output should exactly match with:
|
95
|
+
| mesg | line | column |
|
96
|
+
| W0646 | 4 | 31 |
|
97
|
+
| W9003 | 4 | 26 |
|
98
|
+
| W0626 | 4 | 26 |
|
99
|
+
|
100
|
+
Scenario: a string-literal of wide characters followed by a compatible
|
101
|
+
string-literal those are replaced by macros
|
102
|
+
Given a target source named "W0646.c" with:
|
103
|
+
"""
|
104
|
+
#define STR1 L"foo"
|
105
|
+
#define STR2 L"bar"
|
106
|
+
|
107
|
+
static const char *str = STR1 STR2; /* OK */
|
108
|
+
"""
|
109
|
+
When I successfully run `adlint W0646.c` on noarch
|
110
|
+
Then the output should exactly match with:
|
111
|
+
| mesg | line | column |
|
112
|
+
| W9003 | 4 | 26 |
|
113
|
+
| W0626 | 4 | 26 |
|
114
|
+
|
115
|
+
# vim:ts=2:sw=2:sts=2:et:
|
@@ -0,0 +1,100 @@
|
|
1
|
+
Feature: W0691
|
2
|
+
|
3
|
+
W0691 detects that `##' operator makes invalid preprocessing token.
|
4
|
+
|
5
|
+
Scenario: resulting a decimal-constant `123456'
|
6
|
+
Given a target source named "W0691.c" with:
|
7
|
+
"""
|
8
|
+
#define MACRO(a, b) a ## b
|
9
|
+
|
10
|
+
double d = (double) MACRO(123, 456); /* OK */
|
11
|
+
"""
|
12
|
+
When I successfully run `adlint W0691.c` on noarch
|
13
|
+
Then the output should exactly match with:
|
14
|
+
| mesg | line | column |
|
15
|
+
| W0442 | 1 | 1 |
|
16
|
+
| W0117 | 3 | 8 |
|
17
|
+
|
18
|
+
Scenario: resulting a floating-constant `.123'
|
19
|
+
Given a target source named "W0691.c" with:
|
20
|
+
"""
|
21
|
+
#define MACRO(a, b) a ## b
|
22
|
+
|
23
|
+
double d = (double) MACRO(., 123); /* OK */
|
24
|
+
"""
|
25
|
+
When I successfully run `adlint W0691.c` on noarch
|
26
|
+
Then the output should exactly match with:
|
27
|
+
| mesg | line | column |
|
28
|
+
| W0442 | 1 | 1 |
|
29
|
+
| W0117 | 3 | 8 |
|
30
|
+
|
31
|
+
Scenario: resulting a floating-constant `3.1415'.
|
32
|
+
Given a target source named "W0691.c" with:
|
33
|
+
"""
|
34
|
+
#define MACRO(a, b) a ## b
|
35
|
+
|
36
|
+
double d = (double) MACRO(3., 1415); /* OK */
|
37
|
+
"""
|
38
|
+
When I successfully run `adlint W0691.c` on noarch
|
39
|
+
Then the output should exactly match with:
|
40
|
+
| mesg | line | column |
|
41
|
+
| W0442 | 1 | 1 |
|
42
|
+
| W0117 | 3 | 8 |
|
43
|
+
|
44
|
+
Scenario: resulting a floating-constant `1.23e3'
|
45
|
+
Given a target source named "W0691.c" with:
|
46
|
+
"""
|
47
|
+
#define MACRO(a, b) a ## b
|
48
|
+
|
49
|
+
double d = (double) MACRO(1.23, e3); /* OK */
|
50
|
+
"""
|
51
|
+
When I successfully run `adlint W0691.c` on noarch
|
52
|
+
Then the output should exactly match with:
|
53
|
+
| mesg | line | column |
|
54
|
+
| W0442 | 1 | 1 |
|
55
|
+
| W0117 | 3 | 8 |
|
56
|
+
|
57
|
+
Scenario: resulting an expression `-123'
|
58
|
+
Given a target source named "W0691.c" with:
|
59
|
+
"""
|
60
|
+
#define MACRO(a, b) a ## b
|
61
|
+
|
62
|
+
double d = (double) MACRO(-, 123); /* W0691 */
|
63
|
+
"""
|
64
|
+
When I successfully run `adlint W0691.c` on noarch
|
65
|
+
Then the output should exactly match with:
|
66
|
+
| mesg | line | column |
|
67
|
+
| W0442 | 1 | 1 |
|
68
|
+
| W0691 | 3 | 21 |
|
69
|
+
| W0117 | 3 | 8 |
|
70
|
+
|
71
|
+
Scenario: resulting an expression `1 / 23'
|
72
|
+
Given a target source named "W0691.c" with:
|
73
|
+
"""
|
74
|
+
#define MACRO(a, b) a ## b
|
75
|
+
|
76
|
+
double d = (double) MACRO(1/, 23); /* W0691 */
|
77
|
+
"""
|
78
|
+
When I successfully run `adlint W0691.c` on noarch
|
79
|
+
Then the output should exactly match with:
|
80
|
+
| mesg | line | column |
|
81
|
+
| W0442 | 1 | 1 |
|
82
|
+
| W0691 | 3 | 21 |
|
83
|
+
| W0195 | 3 | 21 |
|
84
|
+
| W0117 | 3 | 8 |
|
85
|
+
|
86
|
+
Scenario: resulting an expression `1.2 * 3.4'
|
87
|
+
Given a target source named "W0691.c" with:
|
88
|
+
"""
|
89
|
+
#define MACRO(a, b) a ## b
|
90
|
+
|
91
|
+
double d = (double) MACRO(1.2*, 3.4); /* W0691 */
|
92
|
+
"""
|
93
|
+
When I successfully run `adlint W0691.c` on noarch
|
94
|
+
Then the output should exactly match with:
|
95
|
+
| mesg | line | column |
|
96
|
+
| W0442 | 1 | 1 |
|
97
|
+
| W0691 | 3 | 21 |
|
98
|
+
| W0117 | 3 | 8 |
|
99
|
+
|
100
|
+
# vim:ts=2:sw=2:sts=2:et:
|