adlint 1.10.0 → 1.12.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.
Files changed (49) hide show
  1. data/ChangeLog +197 -4
  2. data/MANIFEST +17 -0
  3. data/NEWS +23 -4
  4. data/etc/mesg.d/en_US/messages.yml +14 -1
  5. data/etc/mesg.d/ja_JP/messages.yml +14 -1
  6. data/features/message_detection/W0093.feature +87 -0
  7. data/features/message_detection/W0687.feature +25 -0
  8. data/features/message_detection/W0688.feature +63 -0
  9. data/features/message_detection/W0689.feature +46 -0
  10. data/features/message_detection/W0690.feature +35 -0
  11. data/features/message_detection/W0698.feature +3 -2
  12. data/features/message_detection/W0703.feature +1 -0
  13. data/features/message_detection/W0723.feature +34 -0
  14. data/features/message_detection/W0732.feature +158 -0
  15. data/features/message_detection/W0733.feature +158 -0
  16. data/features/message_detection/W0734.feature +322 -0
  17. data/features/message_detection/W0735.feature +322 -0
  18. data/features/message_detection/W1052.feature +66 -0
  19. data/features/message_detection/W9001.feature +33 -0
  20. data/features/message_detection/W9003.feature +131 -0
  21. data/lib/adlint/c/ctrlexpr.rb +51 -50
  22. data/lib/adlint/c/domain.rb +237 -223
  23. data/lib/adlint/c/expr.rb +6 -8
  24. data/lib/adlint/c/interp.rb +8 -11
  25. data/lib/adlint/c/message.rb +20 -0
  26. data/lib/adlint/c/message_shima.rb +63 -0
  27. data/lib/adlint/c/object.rb +5 -4
  28. data/lib/adlint/c/operator.rb +99 -0
  29. data/lib/adlint/c/parser.rb +2 -2
  30. data/lib/adlint/c/parser.y +2 -2
  31. data/lib/adlint/c/phase.rb +6 -1
  32. data/lib/adlint/c/syntax.rb +442 -30
  33. data/lib/adlint/c/type.rb +449 -363
  34. data/lib/adlint/c/value.rb +96 -25
  35. data/lib/adlint/c.rb +1 -0
  36. data/lib/adlint/prelude.rb +16 -18
  37. data/lib/adlint/version.rb +2 -2
  38. data/share/doc/developers_guide_ja.html +11 -5
  39. data/share/doc/developers_guide_ja.texi +9 -3
  40. data/share/doc/users_guide_en.html +697 -131
  41. data/share/doc/users_guide_en.texi +491 -41
  42. data/share/doc/users_guide_ja.html +709 -139
  43. data/share/doc/users_guide_ja.texi +499 -45
  44. data/spec/adlint/c/ctrlexpr_spec.rb +168 -0
  45. data/spec/adlint/c/domain_spec.rb +835 -0
  46. data/spec/adlint/c/operator_spec.rb +406 -0
  47. data/spec/adlint/c/syntax_spec.rb +717 -0
  48. data/spec/adlint/c/type_spec.rb +55 -30
  49. metadata +19 -2
data/ChangeLog CHANGED
@@ -1,3 +1,196 @@
1
+ Wed Jun 20 13:36:49 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 1.12.0
4
+ - Add W0732 detection.
5
+ - Add W0733 detection.
6
+ - Add W0734 detection.
7
+ - Add W0735 detection.
8
+ - Add W9003 detection.
9
+ - Revise the value domain narrowing in order not to over-narrow and
10
+ under-narrow a value domain of the controlling variable.
11
+ - Fix bad multiplication logic in order to detect W0723 and W1052
12
+ correctly.
13
+ - Add unit specifications of domain of variables' value.
14
+ - Add unit specifications of syntax tree of the C language.
15
+ - Add W0093, W0687, W0688, W0689, W0690, W0732, W0733, W0734, W0735,
16
+ W1052, W9001 and W9003 functional specifications.
17
+ - Add W1066, W1067, W1068, W1069, W1070, W1071, W1072, W1073, W1074,
18
+ W1075, W1076, W1077 and W9003 message definitions.
19
+
20
+ Wed Jun 20 10:49:52 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
21
+
22
+ * release.rc : 1.11.2
23
+ - Revise W9003 specification not to over-warn about natural
24
+ conversions.
25
+
26
+ Wed Jun 20 10:46:17 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
27
+
28
+ * lib/adlint/c/message.rb : Revise W9003 specification not to
29
+ over-warn about natural conversions.
30
+
31
+ Tue Jun 19 17:37:04 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
32
+
33
+ * release.rc : 1.11.1
34
+ - Add W9003 detection.
35
+
36
+ Tue Jun 19 16:33:54 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
37
+
38
+ * features/message_detection/W9003.feature : Add W9003 functional
39
+ specification.
40
+ * MANIFEST : Ditto.
41
+
42
+ * lib/adlint/c/type.rb : Add Type#standard? predicate method and
43
+ insert StandardFloatingType in FloatingType class hierarchy.
44
+
45
+ * lib/adlint/c/type.rb : Revise integer-promotion rule of any
46
+ enumerated types in order not to over-warn W9003 about enum-enum
47
+ expressions.
48
+
49
+ * lib/adlint/c/message.rb : Add W9003 detection.
50
+ * lib/adlint/c/phase.rb : Ditto.
51
+
52
+ Tue Jun 19 14:48:20 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
53
+
54
+ * share/doc/users_guide_ja.texi : Update descriptions about W0732,
55
+ W0733, W0734 and W0735 messages.
56
+ * share/doc/users_guide_en.texi : Ditto.
57
+
58
+ * share/doc/users_guide_ja.texi : Add W1066, W1067, W1068, W1069,
59
+ W1070, W1071, W1072, W1073, W1074, W1075, W1076, W1077 and W9003
60
+ message definitions.
61
+ * share/doc/users_guide_en.texi : Ditto.
62
+
63
+ Fri Jun 15 17:25:51 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
64
+
65
+ * release.rc : 1.11.0
66
+ - This is the initial release candidate for 1.12.0 GA release.
67
+ - Add W0732 detection.
68
+ - Add W0733 detection.
69
+ - Add W0734 detection.
70
+ - Add W0735 detection.
71
+ - Revise the value domain narrowing in order not to over-narrow and
72
+ under-narrow a value domain of the controlling variable.
73
+ - Fix bad multiplication logic in order to detect W0723 and W1052
74
+ correctly.
75
+ - Add unit specifications of domain of variables' value.
76
+ - Add unit specifications of syntax tree of the C language.
77
+ - Add W0093, W0687, W0688, W0689, W0690, W0732, W0733, W0734, W0735,
78
+ W1052 and W9001 functional specifications.
79
+ - Add W1066, W1067, W1068, W1069, W1070, W1071, W1072, W1073, W1074,
80
+ W1075, W1076, W1077 and W9003 message definitions.
81
+
82
+ Wed Jun 13 18:20:47 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
83
+
84
+ * features/message_detection/W0723.feature : Add W0723 functional
85
+ specification to reproduce a known bug.
86
+ * features/message_detection/W1052.feature : Add W1052 functional
87
+ specification to reproduce a known bug.
88
+ * MANIFEST : Ditto.
89
+
90
+ * lib/adlint/c/domain.rb : Fix bad multiplication logic of
91
+ IntersectionValueDomain in order to detect W0723 and W1052
92
+ correctly.
93
+
94
+ Wed Jun 13 15:57:32 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
95
+
96
+ * lib/adlint/c/syntax.rb : Add predicate methods to check whether an
97
+ expression is #arithmetic? or #bitwise?.
98
+ * spec/adlint/c/syntax_spec.rb : Add unit specifications of syntax
99
+ tree of the C language.
100
+ * MANIFEST : Ditto.
101
+
102
+ * lib/adlint/c/message_shima.rb : Add W0732, W0733, W0734 and W0735
103
+ detections.
104
+ * lib/adlint/c/phase.rb : Ditto.
105
+
106
+ * features/message_detection/W0732.feature : Add W0732 functional
107
+ specification.
108
+ * features/message_detection/W0733.feature : Add W0733 functional
109
+ specification.
110
+ * features/message_detection/W0734.feature : Add W0734 functional
111
+ specification.
112
+ * features/message_detection/W0735.feature : Add W0735 functional
113
+ specification.
114
+ * MANIFEST : Add W0732, W0733, W0735 and W0690 functional
115
+ specifications.
116
+
117
+ Wed Jun 13 11:59:36 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
118
+
119
+ * lib/adlint/c/ctrlexpr.rb : Revise the value domain narrowing in
120
+ order not to under-narrow a value domain of the controlling variable.
121
+ * lib/adlint/c/value.rb : Ditto.
122
+
123
+ * features/message_detection/W0093.feature : Add W0093 functional
124
+ specification to reproduce a known bug.
125
+ * MANIFEST : Ditto.
126
+
127
+ Tue Jun 12 18:41:54 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
128
+
129
+ * spec/adlint/c/ctrlexpr_spec.rb : Add unit specifications of
130
+ controlling expression of selection-statements and
131
+ iteration-statements.
132
+
133
+ Mon Jun 11 17:49:11 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
134
+
135
+ * lib/adlint/prelude.rb : Add __NOTREACHED__ function in order to ease
136
+ debugging.
137
+ * lib/adlint/c/expr.rb : Ditto.
138
+ * lib/adlint/c/ctrlexpr.rb : Ditto.
139
+ * lib/adlint/c/domain.rb : Ditto.
140
+ * lib/adlint/c.rb : Ditto.
141
+
142
+ * lib/adlint/c/operator.rb : Add Operator and ComparisonOperator to
143
+ represent a comparison operator symbol directly and move
144
+ responsibilities to Operator from ::Symbol.
145
+ * spec/adlint/c/operator_spec.rb : Ditto.
146
+ * spec/adlint/c/domain_spec.rb : Ditto.
147
+ * lib/adlint/c/interp.rb : Ditto.
148
+ * lib/adlint/c/ctrlexpr.rb : Ditto.
149
+ * lib/adlint/c/type.rb : Ditto.
150
+ * lib/adlint/c/object.rb : Ditto.
151
+ * lib/adlint/c/value.rb : Ditto.
152
+ * lib/adlint/c/domain.rb : Ditto.
153
+ * lib/adlint/prelude.rb : Ditto.
154
+ * MANIFEST : Ditto.
155
+
156
+ Fri Jun 8 14:43:14 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
157
+
158
+ * lib/adlint/c/value.rb : Add Value#definite? to check whether the
159
+ value is definite.
160
+
161
+ * features/message_detection/W9001.feature : Add W9001 functional
162
+ specification to reproduce a known bug.
163
+ * MANIFEST : Ditto.
164
+
165
+ * lib/adlint/c/ctrlexpr.rb : Revise the value domain narrowing in
166
+ order not to over-narrow a value domain of the controlling variable.
167
+
168
+ Thu Jun 7 16:30:23 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
169
+
170
+ * spec/adlint/c/domain_spec.rb : Add unit specifications of domain of
171
+ variables' value.
172
+ * MANIFEST : Ditto.
173
+
174
+ Thu Jun 7 11:54:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
175
+
176
+ * etc/mesg.d/ja_JP/messages.yml : Add W1066, W1067, W1068, W1069,
177
+ W1070, W1071, W1072, W1073, W1074, W1075, W1076, W1077 and W9003
178
+ message definitions.
179
+ * etc/mesg.d/en_US/messages.yml : Ditto.
180
+
181
+ Wed Jun 6 11:27:32 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
182
+
183
+ * features/message_detection/W0687.feature : Add W0687 functional
184
+ specification.
185
+ * features/message_detection/W0688.feature : Add W0688 functional
186
+ specification.
187
+ * features/message_detection/W0689.feature : Add W0689 functional
188
+ specification.
189
+ * features/message_detection/W0690.feature : Add W0690 functional
190
+ specification.
191
+ * MANIFEST : Add W0687, W0688, W0689 and W0690 functional
192
+ specifications.
193
+
1
194
  Wed Jun 6 10:19:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
195
 
3
196
  * release.ga : 1.10.0
@@ -15,7 +208,7 @@ Wed Jun 6 10:19:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
15
208
  and definition without storage-class-specifier.
16
209
  - Fix lack of sequence-point notification of controlling
17
210
  expressions.
18
- - Add unit specification of C type models.
211
+ - Add unit specifications of C type models.
19
212
  - Add W0001, W0002, W0003, W0007, W0010, W0013, W0109, W0583, W0606,
20
213
  W0698, W0699, W0703, W0716, W0717, W0718, W0723 and W1031
21
214
  functional specifications.
@@ -125,7 +318,7 @@ Thu May 31 09:43:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
125
318
  expressions.
126
319
  - Fix W0582, W0583 and W0584 detections in order to consider type
127
320
  convertibility correctly.
128
- - Add unit specification of C type models.
321
+ - Add unit specifications of C type models.
129
322
  - Add W0001, W0002, W0003, W0007, W0010, W0013, W0583, W0716, W0717
130
323
  and W0718 functional specifications.
131
324
 
@@ -153,7 +346,7 @@ Wed May 30 19:18:11 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
153
346
  * lib/adlint/c/type.rb : Add Type#convertible?(to_type) method to
154
347
  check whether a type is implicitly convertible to another type.
155
348
 
156
- * spec/adlint/c/type_spec.rb : Add unit specification of C type
349
+ * spec/adlint/c/type_spec.rb : Add more unit specifications of C type
157
350
  models.
158
351
 
159
352
  Wed May 30 15:38:00 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
@@ -250,7 +443,7 @@ Tue May 22 12:12:08 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
250
443
 
251
444
  Mon May 21 16:33:19 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
252
445
 
253
- * spec/adlint/c/type_spec.rb : Add unit specification of C type
446
+ * spec/adlint/c/type_spec.rb : Add unit specifications of C type
254
447
  models.
255
448
  * MANIFEST : Ditto.
256
449
 
data/MANIFEST CHANGED
@@ -34,9 +34,14 @@ features/message_detection/W0003.feature
34
34
  features/message_detection/W0007.feature
35
35
  features/message_detection/W0010.feature
36
36
  features/message_detection/W0013.feature
37
+ features/message_detection/W0093.feature
37
38
  features/message_detection/W0109.feature
38
39
  features/message_detection/W0583.feature
39
40
  features/message_detection/W0606.feature
41
+ features/message_detection/W0687.feature
42
+ features/message_detection/W0688.feature
43
+ features/message_detection/W0689.feature
44
+ features/message_detection/W0690.feature
40
45
  features/message_detection/W0698.feature
41
46
  features/message_detection/W0699.feature
42
47
  features/message_detection/W0703.feature
@@ -44,7 +49,14 @@ features/message_detection/W0716.feature
44
49
  features/message_detection/W0717.feature
45
50
  features/message_detection/W0718.feature
46
51
  features/message_detection/W0723.feature
52
+ features/message_detection/W0732.feature
53
+ features/message_detection/W0733.feature
54
+ features/message_detection/W0734.feature
55
+ features/message_detection/W0735.feature
47
56
  features/message_detection/W1031.feature
57
+ features/message_detection/W1052.feature
58
+ features/message_detection/W9001.feature
59
+ features/message_detection/W9003.feature
48
60
  features/step_definitions/message_detection_steps.rb
49
61
  features/support/env.rb
50
62
  lib/adlint.rb
@@ -68,6 +80,7 @@ lib/adlint/c/message.rb
68
80
  lib/adlint/c/message_shima.rb
69
81
  lib/adlint/c/metric.rb
70
82
  lib/adlint/c/object.rb
83
+ lib/adlint/c/operator.rb
71
84
  lib/adlint/c/option.rb
72
85
  lib/adlint/c/parser.y
73
86
  lib/adlint/c/parser.rb
@@ -504,6 +517,10 @@ share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h
504
517
  share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h
505
518
  share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml
506
519
  spec/spec_helper.rb
520
+ spec/adlint/c/ctrlexpr_spec.rb
521
+ spec/adlint/c/domain_spec.rb
522
+ spec/adlint/c/operator_spec.rb
523
+ spec/adlint/c/syntax_spec.rb
507
524
  spec/adlint/c/type_spec.rb
508
525
  spec/conf.d/empty_cinit.h
509
526
  spec/conf.d/empty_pinit.h
data/NEWS CHANGED
@@ -21,6 +21,29 @@
21
21
 
22
22
  ++
23
23
 
24
+ === \AdLint 1.12.0 is released (2012-06-20)
25
+
26
+ ==== Changes since the 1.10.0 release
27
+
28
+ * Add W0732 detection
29
+ * Add W0733 detection
30
+ * Add W0734 detection
31
+ * Add W0735 detection
32
+ * Add W9003 detection
33
+ * Revise the value domain narrowing in order not to over-narrow and
34
+ under-narrow a value domain of the controlling variable
35
+ * Fix bad multiplication logic in order to detect W0723 and W1052 correctly
36
+ * Add unit specifications of domain of variables' value
37
+ * Add unit specifications of syntax tree of the C language
38
+ * Add W0093, W0687, W0688, W0689, W0690, W0732, W0733, W0734, W0735, W1052,
39
+ W9001 and W9003 functional specifications
40
+ * Add W1066, W1067, W1068, W1069, W1070, W1071, W1072, W1073, W1074, W1075,
41
+ W1076, W1077 and W9003 message definitions
42
+
43
+ See the file
44
+ {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
45
+ for more details.
46
+
24
47
  === \AdLint 1.10.0 is released (2012-06-06)
25
48
 
26
49
  ==== Changes since the 1.8.10 release
@@ -41,10 +64,6 @@
41
64
  * Add W0001, W0002, W0003, W0007, W0010, W0013, W0109, W0583, W0606, W0698,
42
65
  W0699, W0703, W0716, W0717, W0718, W0723 and W1031 functional specifications
43
66
 
44
- See the file
45
- {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
46
- for more details.
47
-
48
67
  === \AdLint 1.8.10 is released (2012-05-18)
49
68
 
50
69
  ==== Changes since the 1.8.2 release
@@ -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.10.0"
39
+ version: "1.12.0"
40
40
 
41
41
  message_definition:
42
42
  X0001: "An unknown exception `%s' is found."
@@ -779,6 +779,19 @@ message_definition:
779
779
  W1063: "The return value returned from enumeration type function to non constant expression."
780
780
  W1064: "A integer constant is used in switch statement where case label is enumeration type."
781
781
  W1065: "A value of different enumeration type is used in switch statement where case label is an enumeration type."
782
+ W1066: "A value of the `float' typed compound expression is explicitly converted into a `double' value."
783
+ W1067: "A value of the `float' typed compound expression is explicitly converted into a `long double' value."
784
+ W1068: "A value of the `double' typed compound expression is explicitly converted into a `long double' value."
785
+ W1069: "No trailing `else' clause is found in this `if-else-if' statements chain."
786
+ W1070: "This `switch' statement can be translated into `if-else' statement because there are only 2 execution paths."
787
+ W1071: "Function `%s' has multiple termination points."
788
+ W1072: "A `goto' statement is found."
789
+ W1073: "A return value of function `%s' is not used."
790
+ W1074: "Side-effects in `sizeof' operand will not be recorded because the operand will not be executed actually."
791
+ W1075: "This declaration has no `static' storage-class-specifier while the declaring object has internal-linkage."
792
+ W1076: "`%s' is defined as internal-linkage, but it has no forward declaration."
793
+ W1077: "Declaring array object without a size."
782
794
  W9001: "This statement doesn't reach the control."
783
795
  W9002: "There is no line feed character at the end of file."
796
+ W9003: "An object typed `%s' is implicitly converted into an object of other type."
784
797
  C0001: "A warning is detected in external identifier name `%s'."
@@ -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.10.0"
39
+ version: "1.12.0"
40
40
 
41
41
  message_definition:
42
42
  X0001: "不明な例外条件 `%s' を検出しました。"
@@ -779,6 +779,19 @@ message_definition:
779
779
  W1063: "戻り値が列挙型の関数から、非定数式が返されています。"
780
780
  W1064: "列挙型の制御式が使われている switch 文で、整数定数が case ラベルに使われています。"
781
781
  W1065: "列挙型の制御式が使われている switch 文で、異なる列挙型の値が case ラベルに使われています。"
782
+ W1066: "明示的に float 型の複合式の値を double 型に変換しています。"
783
+ W1067: "明示的に float 型の複合式の値を long double 型に変換しています。"
784
+ W1068: "明示的に double 型の複合式の値を long double 型に変換しています。"
785
+ W1069: "この `if-else-if' 文には、末尾の `else' 節がありません。"
786
+ W1070: "この `switch' 文には実行経路が 2 つしか無いため、`if-else' 文に変換可能です。"
787
+ W1071: "関数 `%s' には複数の終了点があります。"
788
+ W1072: "`goto' 文を使用しています。"
789
+ W1073: "関数 `%s' の戻り値を破棄しています。"
790
+ W1074: "`sizeof' 演算子のオペランドは実行されないため、副作用が発生しません。"
791
+ W1075: "`%s' は以前に内部結合として宣言されていますが、この宣言には `static' がありません。"
792
+ W1076: "関数 `%s' は内部結合を持ちますが、事前に内部結合として宣言していません。"
793
+ W1077: "サイズが省略された配列を宣言しています。"
782
794
  W9001: "この文には制御が到達しません。"
783
795
  W9002: "ファイルの末尾に改行文字がありません。"
796
+ W9003: "暗黙的に `%s' 型のオブジェクトが異なる型のオブジェクトに変換されています。"
784
797
  C0001: "この外部識別名 `%s' で警告を検知しました。"
@@ -0,0 +1,87 @@
1
+ Feature: W0093
2
+
3
+ W0093 detects that a division-by-zero may occur.
4
+
5
+ Scenario: narrowing denominator variable by an iteration controlling
6
+ variable which has same value domain of the denominator.
7
+ Given a target source named "W0093.c" with:
8
+ """
9
+ static void foo(void)
10
+ {
11
+ int k;
12
+
13
+ for (int i = 0; i < 10; i++) {
14
+ for (int j = 0; j < 10; j++) {
15
+ if (i == j) {
16
+ k = j / i; /* W0093 */
17
+ }
18
+ else {
19
+ k = j / i; /* W0093 */
20
+ }
21
+ }
22
+ }
23
+ }
24
+ """
25
+ When I successfully run `adlint W0093.c` on noarch
26
+ Then the output should exactly match with:
27
+ | mesg | line | column |
28
+ | W0093 | 8 | 23 |
29
+ | W0093 | 11 | 23 |
30
+ | W0629 | 1 | 13 |
31
+ | W0628 | 1 | 13 |
32
+
33
+ Scenario: narrowing denominator variable by an iteration controlling
34
+ variable which has narrower value domain than the denominator.
35
+ Given a target source named "W0093.c" with:
36
+ """
37
+ static void foo(void)
38
+ {
39
+ int k;
40
+
41
+ for (int i = 0; i < 10; i++) {
42
+ for (int j = 3; j < 5; j++) {
43
+ if (i == j) {
44
+ k = j / i; /* OK */
45
+ }
46
+ else {
47
+ k = j / i; /* W0093 */
48
+ }
49
+ }
50
+ }
51
+ }
52
+ """
53
+ When I successfully run `adlint W0093.c` on noarch
54
+ Then the output should exactly match with:
55
+ | mesg | line | column |
56
+ | W0093 | 11 | 23 |
57
+ | W0629 | 1 | 13 |
58
+ | W0628 | 1 | 13 |
59
+
60
+ Scenario: narrowing denominator variable by an iteration controlling
61
+ variable which has narrower value domain contains zero.
62
+ Given a target source named "W0093.c" with:
63
+ """
64
+ static void foo(void)
65
+ {
66
+ int k;
67
+
68
+ for (int i = -5; i < 5; i++) {
69
+ for (int j = -1; j < 2; j++) {
70
+ if (i == j) {
71
+ k = j / i; /* W0093 */
72
+ }
73
+ else {
74
+ k = j / i; /* OK */
75
+ }
76
+ }
77
+ }
78
+ }
79
+ """
80
+ When I successfully run `adlint W0093.c` on noarch
81
+ Then the output should exactly match with:
82
+ | mesg | line | column |
83
+ | W0093 | 8 | 23 |
84
+ | W0629 | 1 | 13 |
85
+ | W0628 | 1 | 13 |
86
+
87
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,25 @@
1
+ Feature: W0687
2
+
3
+ W0687 detects that #undef directive deletes the `defined' operator.
4
+
5
+ Scenario: #undef directive with the `defined' operator
6
+ Given a target source named "W0687.c" with:
7
+ """
8
+ #undef defined /* W0687 */
9
+ """
10
+ When I successfully run `adlint W0687.c` on noarch
11
+ Then the output should exactly match with:
12
+ | mesg | line | column |
13
+ | W0687 | 1 | 8 |
14
+
15
+ Scenario: #undef directive with ordinary macro name
16
+ Given a target source named "W0687.c" with:
17
+ """
18
+ #define MACRO (0)
19
+ #undef MACRO /* OK */
20
+ """
21
+ When I successfully run `adlint W0687.c` on noarch
22
+ Then the output should exactly match with:
23
+ | mesg | line | column |
24
+
25
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,63 @@
1
+ Feature: W0688
2
+
3
+ W0688 detects that the line number of #line directive is less than 1 or
4
+ greater than 32767.
5
+
6
+ Scenario: zero as the line number
7
+ Given a target source named "W0688.c" with:
8
+ """
9
+ #line 0 "test.c" /* W0688 */
10
+ """
11
+ When I successfully run `adlint W0688.c` on noarch
12
+ Then the output should exactly match with:
13
+ | mesg | line | column |
14
+ | W0688 | 1 | 7 |
15
+
16
+ Scenario: valid min line number
17
+ Given a target source named "W0688.c" with:
18
+ """
19
+ #line 1 "test.c" /* OK */
20
+ """
21
+ When I successfully run `adlint W0688.c` on noarch
22
+ Then the output should exactly match with:
23
+ | mesg | line | column |
24
+
25
+ Scenario: valid line number
26
+ Given a target source named "W0688.c" with:
27
+ """
28
+ #line 1024 "test.c" /* OK */
29
+ """
30
+ When I successfully run `adlint W0688.c` on noarch
31
+ Then the output should exactly match with:
32
+ | mesg | line | column |
33
+
34
+ Scenario: valid max line number
35
+ Given a target source named "W0688.c" with:
36
+ """
37
+ #line 32767 "test.c" /* OK */
38
+ """
39
+ When I successfully run `adlint W0688.c` on noarch
40
+ Then the output should exactly match with:
41
+ | mesg | line | column |
42
+
43
+ Scenario: 32768 as the line number
44
+ Given a target source named "W0688.c" with:
45
+ """
46
+ #line 32768 "test.c" /* W0688 */
47
+ """
48
+ When I successfully run `adlint W0688.c` on noarch
49
+ Then the output should exactly match with:
50
+ | mesg | line | column |
51
+ | W0688 | 1 | 7 |
52
+
53
+ Scenario: too big as the line number
54
+ Given a target source named "W0688.c" with:
55
+ """
56
+ #line 4294967296 "test.c" /* W0688 */
57
+ """
58
+ When I successfully run `adlint W0688.c` on noarch
59
+ Then the output should exactly match with:
60
+ | mesg | line | column |
61
+ | W0688 | 1 | 7 |
62
+
63
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,46 @@
1
+ Feature: W0689
2
+
3
+ W0689 detects that the syntax of #line directive is illformed.
4
+
5
+ Scenario: line number as an arithmetic-expression and no file name
6
+ Given a target source named "W0689.c" with:
7
+ """
8
+ #line 35 * 100 /* W0689 */
9
+ """
10
+ When I successfully run `adlint W0689.c` on noarch
11
+ Then the output should exactly match with:
12
+ | mesg | line | column |
13
+ | W0689 | 1 | 10 |
14
+
15
+ Scenario: line number as an arithmetic-expression and valid file name
16
+ Given a target source named "W0689.c" with:
17
+ """
18
+ #line 35 * 100 "test.c" /* W0689 */
19
+ """
20
+ When I successfully run `adlint W0689.c` on noarch
21
+ Then the output should exactly match with:
22
+ | mesg | line | column |
23
+ | W0689 | 1 | 10 |
24
+
25
+ Scenario: valid line number and invalid file name
26
+ Given a target source named "W0689.c" with:
27
+ """
28
+ #line 35 L"******.c" /* W0689 */
29
+ """
30
+ When I successfully run `adlint W0689.c` on noarch
31
+ Then the output should exactly match with:
32
+ | mesg | line | column |
33
+ | W0689 | 1 | 10 |
34
+
35
+ Scenario: inverted arguments
36
+ Given a target source named "W0689.c" with:
37
+ """
38
+ #line __FILE__ 35 /* W0689 */
39
+ """
40
+ When I successfully run `adlint W0689.c` on noarch
41
+ Then the output should exactly match with:
42
+ | mesg | line | column |
43
+ | W0689 | 1 | 16 |
44
+ | W0690 | 1 | 7 |
45
+
46
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,35 @@
1
+ Feature: W0690
2
+
3
+ W0690 detects that no line number is in the #line directive.
4
+
5
+ Scenario: an identifier as arguments
6
+ Given a target source named "W0690.c" with:
7
+ """
8
+ #line LINE1000 /* W0690 */
9
+ """
10
+ When I successfully run `adlint W0690.c` on noarch
11
+ Then the output should exactly match with:
12
+ | mesg | line | column |
13
+ | W0690 | 1 | 7 |
14
+
15
+ Scenario: inverted arguments
16
+ Given a target source named "W0690.c" with:
17
+ """
18
+ #line __FILE__ 35 /* W0690 */
19
+ """
20
+ When I successfully run `adlint W0690.c` on noarch
21
+ Then the output should exactly match with:
22
+ | mesg | line | column |
23
+ | W0689 | 1 | 16 |
24
+ | W0690 | 1 | 7 |
25
+
26
+ Scenario: line number and macro replaceable filename
27
+ Given a target source named "W0690.c" with:
28
+ """
29
+ #line 35 __FILE__ 35 /* OK */
30
+ """
31
+ When I successfully run `adlint W0690.c` on noarch
32
+ Then the output should exactly match with:
33
+ | mesg | line | column |
34
+
35
+ # vim:ts=2:sw=2:sts=2:et:
@@ -1,8 +1,9 @@
1
1
  Feature: W0698
2
2
 
3
- W0698 detects that`return;' statement is found at except void function.
3
+ W0698 detects that a `return' statement without expression is found in a
4
+ non-void function.
4
5
 
5
- Scenario: return statement
6
+ Scenario: returning nothing from `int' function
6
7
  Given a target source named "W0698.c" with:
7
8
  """
8
9
  int func(void)
@@ -66,6 +66,7 @@ Feature: W0703
66
66
  | W0704 | 5 | 14 |
67
67
  | W0785 | 5 | 10 |
68
68
  | W0789 | 5 | 14 |
69
+ | W9003 | 6 | 12 |
69
70
  | W1060 | 6 | 12 |
70
71
  | W0100 | 5 | 25 |
71
72
  | W0425 | 5 | 25 |