adlint 1.8.10 → 1.10.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 (56) hide show
  1. data/ChangeLog +261 -3
  2. data/MANIFEST +25 -1
  3. data/NEWS +25 -5
  4. data/Rakefile +11 -0
  5. data/TODO +0 -1
  6. data/etc/mesg.d/en_US/messages.yml +1 -1
  7. data/etc/mesg.d/ja_JP/messages.yml +1 -1
  8. data/features/message_detection/W0001.feature +41 -0
  9. data/features/message_detection/W0002.feature +68 -0
  10. data/features/message_detection/W0003.feature +134 -0
  11. data/features/message_detection/W0007.feature +264 -0
  12. data/features/message_detection/W0010.feature +75 -0
  13. data/features/message_detection/W0013.feature +189 -0
  14. data/features/message_detection/W0109.feature +50 -0
  15. data/features/message_detection/W0583.feature +30 -0
  16. data/features/message_detection/W0606.feature +20 -0
  17. data/features/message_detection/W0698.feature +20 -0
  18. data/features/message_detection/W0699.feature +21 -0
  19. data/features/message_detection/W0703.feature +73 -0
  20. data/features/message_detection/W0716.feature +67 -0
  21. data/features/message_detection/W0717.feature +64 -0
  22. data/features/message_detection/W0718.feature +64 -0
  23. data/features/message_detection/W0723.feature +18 -0
  24. data/features/message_detection/W1031.feature +328 -0
  25. data/features/step_definitions/message_detection_steps.rb +45 -0
  26. data/features/support/env.rb +58 -0
  27. data/lib/adlint/c/branch.rb +16 -23
  28. data/lib/adlint/c/code.rb +1 -12
  29. data/lib/adlint/c/conv.rb +4 -4
  30. data/lib/adlint/c/ctrlexpr.rb +10 -6
  31. data/lib/adlint/c/domain.rb +2 -2
  32. data/lib/adlint/c/expr.rb +11 -33
  33. data/lib/adlint/c/format.rb +6 -6
  34. data/lib/adlint/c/interp.rb +137 -80
  35. data/lib/adlint/c/mediator.rb +5 -2
  36. data/lib/adlint/c/message.rb +123 -140
  37. data/lib/adlint/c/message_shima.rb +44 -0
  38. data/lib/adlint/c/object.rb +93 -26
  39. data/lib/adlint/c/option.rb +53 -0
  40. data/lib/adlint/c/phase.rb +4 -1
  41. data/lib/adlint/c/type.rb +112 -46
  42. data/lib/adlint/c.rb +1 -0
  43. data/lib/adlint/version.rb +3 -3
  44. data/share/doc/developers_guide_ja.html +3 -3
  45. data/share/doc/developers_guide_ja.texi +1 -1
  46. data/share/doc/users_guide_en.html +35 -28
  47. data/share/doc/users_guide_en.texi +30 -22
  48. data/share/doc/users_guide_ja.html +35 -31
  49. data/share/doc/users_guide_ja.texi +30 -24
  50. data/spec/adlint/c/type_spec.rb +110 -0
  51. data/spec/conf.d/default_traits.yml +216 -0
  52. data/spec/conf.d/empty_cinit.h +11 -0
  53. data/spec/conf.d/empty_pinit.h +11 -0
  54. data/spec/spec_helper.rb +49 -0
  55. metadata +27 -3
  56. data/spec/MUST_WRITE_SPECS_WITH_RSPEC +0 -0
data/ChangeLog CHANGED
@@ -1,3 +1,261 @@
1
+ Wed Jun 6 10:19:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 1.10.0
4
+ - Add W0716 detection.
5
+ - Add W0717 detection.
6
+ - Add W0718 detection.
7
+ - Fix W0500 detection not to warn when two standalone binary
8
+ arithmetic expressions are appears at 2nd and 3rd expressions of a
9
+ conditional-expression.
10
+ - Fix W0501 detection not to duplicate warnings about a
11
+ conditional-expression.
12
+ - Fix W0582, W0583 and W0584 detections in order to consider type
13
+ convertibility correctly.
14
+ - Fix W1031 detection not to warn when the declaration with `static'
15
+ and definition without storage-class-specifier.
16
+ - Fix lack of sequence-point notification of controlling
17
+ expressions.
18
+ - Add unit specification of C type models.
19
+ - Add W0001, W0002, W0003, W0007, W0010, W0013, W0109, W0583, W0606,
20
+ W0698, W0699, W0703, W0716, W0717, W0718, W0723 and W1031
21
+ functional specifications.
22
+
23
+ Tue Jun 5 16:45:06 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
24
+
25
+ * release.rc : 1.9.2
26
+ - Fix W1031 detection to correctly warn when the declaration with
27
+ `extern' and the definition with `static'.
28
+ - Remove initialization semantics of the program execution which is
29
+ not comply with the ISO C99 standard.
30
+
31
+ Tue Jun 5 15:58:40 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
32
+
33
+ * lib/adlint/c/interp.rb : Remove initialization semantics of the
34
+ program execution which is not comply with the ISO C99 standard.
35
+ * lib/adlint/c/object.rb : Ditto.
36
+
37
+ Tue Jun 5 13:44:28 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
38
+
39
+ * features/message_detection/W0703.feature : Add W0703 functional
40
+ specification to reproduce a known bug.
41
+ * features/message_detection/W0109.feature : Add W0109 functional
42
+ specification to reproduce a known bug.
43
+ * MANIFEST : Ditto.
44
+
45
+ Mon Jun 4 18:23:48 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
46
+
47
+ * lib/adlint/c/message.rb : Fix W1031 detection to correctly warn when
48
+ the declaration with `extern' and the definition with `static'.
49
+
50
+ * lib/adlint/c/interp.rb : Add notification about function-definition.
51
+ * lib/adlint/c/mediator.rb : Ditto.
52
+ * lib/adlint/c/message.rb : Ditto.
53
+ * lib/adlint/c/code.rb : Ditto.
54
+
55
+ * lib/adlint/c/object.rb : Fix bad linkage determination logic.
56
+
57
+ * features/message_detection/W1031.feature : Add W1031 functional
58
+ specification to reproduce a known bug.
59
+
60
+ Fri Jun 1 19:50:31 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
61
+
62
+ * release.rc : 1.9.1
63
+ - Fix W1031 detection not to warn when the declaration with `static'
64
+ and definition without storage-class-specifier.
65
+ - Support initialization semantics preceding the program starup in
66
+ order to correctly evaluate expressions in initializers of the
67
+ static storage duration object definition.
68
+ - Add W0606, W0698 and W0699 functional specifications.
69
+
70
+ Fri Jun 1 19:01:13 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
71
+
72
+ * lib/adlint/c/interp.rb : Support initialization semantics preceding
73
+ the program starup in order to correctly evaluate expressions in
74
+ initializers of the static storage duration object definition.
75
+ * lib/adlint/c/phase.rb : Ditto.
76
+ * lib/adlint/c/mediator.rb : Ditto.
77
+ * lib/adlint/c/object.rb : Ditto.
78
+
79
+ * lib/adlint/c/option.rb : Add new module `option.rb' to define whole
80
+ option constants.
81
+ * lib/adlint/c/type.rb : Ditto.
82
+ * lib/adlint/c/branch.rb : Ditto.
83
+ * lib/adlint/c/ctrlexpr.rb : Ditto.
84
+ * lib/adlint/c/message.rb : Ditto.
85
+ * lib/adlint/c.rb : Ditto.
86
+ * MANIFEST : Ditto.
87
+
88
+ Fri Jun 1 15:42:00 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
89
+
90
+ * features/message_detection/W0606.feature : Add W0606 functional
91
+ specification.
92
+ * features/message_detection/W0698.feature : Add W0698 functional
93
+ specification.
94
+ * features/message_detection/W0699.feature : Add W0699 functional
95
+ specification.
96
+ * MANIFEST : Add W0606, W0698 and W0699 functional specifications.
97
+
98
+ Thu May 31 11:46:58 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
99
+
100
+ * features/message_detection/W0723.feature : Add W0723 functional
101
+ specification to reproduce a known bug.
102
+
103
+ Thu May 31 11:32:16 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
104
+
105
+ * features/message_detection/W1031.feature : Add W1031 functional
106
+ specification to reproduce a known bug.
107
+
108
+ * lib/adlint/c/message.rb : Fix W1031 detection not to warn when the
109
+ declaration with `static' and definition without
110
+ storage-class-specifier.
111
+
112
+ Thu May 31 09:43:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
113
+
114
+ * release.rc : 1.9.0
115
+ - This is the initial release candidate for 1.10.0 GA release.
116
+ - Add W0716 detection.
117
+ - Add W0717 detection.
118
+ - Add W0718 detection.
119
+ - Fix W0501 detection not to duplicate warnings about a
120
+ conditional-expression.
121
+ - Fix W0500 detection not to warn when two standalone binary
122
+ arithmetic expressions are appears at 2nd and 3rd expressions of a
123
+ conditional-expression.
124
+ - Fix lack of sequence-point notification of controlling
125
+ expressions.
126
+ - Fix W0582, W0583 and W0584 detections in order to consider type
127
+ convertibility correctly.
128
+ - Add unit specification of C type models.
129
+ - Add W0001, W0002, W0003, W0007, W0010, W0013, W0583, W0716, W0717
130
+ and W0718 functional specifications.
131
+
132
+ Wed May 30 22:23:41 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
133
+
134
+ * spec/adlint/c/type_spec.rb : Add `more cv-qualified' unit
135
+ specification.
136
+
137
+ Wed May 30 20:17:38 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
138
+
139
+ * lib/adlint/c/conv.rb : Fix Type#same_as? method invocation to
140
+ conform with lhs and rhs order of other invocations.
141
+ * lib/adlint/c/expr.rb : Ditto.
142
+ * lib/adlint/c/object.rb : Ditto.
143
+ * lib/adlint/c/message.rb : Ditto.
144
+
145
+ * lib/adlint/c/format.rb : Fix too strict argument type checkings in
146
+ order to consider type convertibility correctly.
147
+
148
+ * lib/adlint/c/message.rb : Fix W0582, W0583 and W0584 detections in
149
+ order to consider type convertibility correctly.
150
+
151
+ Wed May 30 19:18:11 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
152
+
153
+ * lib/adlint/c/type.rb : Add Type#convertible?(to_type) method to
154
+ check whether a type is implicitly convertible to another type.
155
+
156
+ * spec/adlint/c/type_spec.rb : Add unit specification of C type
157
+ models.
158
+
159
+ Wed May 30 15:38:00 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
160
+
161
+ * share/doc/users_guide_ja.texi : Update descriptions about added
162
+ warning messages.
163
+ * share/doc/users_guide_en.texi : Ditto.
164
+
165
+ Tue May 29 16:18:00 2012 Rie Shima <rkakuuchi@users.sourceforge.net>
166
+
167
+ * lib/adlint/c/message_shima.rb : Add W0716, W0717 and W0718
168
+ detections.
169
+ * lib/adlint/c/phase.rb : Ditto.
170
+
171
+ * features/message_detection/W0716.feature : Add W0716 functional
172
+ specification.
173
+ * features/message_detection/W0717.feature : Add W0717 functional
174
+ specification.
175
+ * features/message_detection/W0718.feature : Add W0718 functional
176
+ specification.
177
+ * MANIFEST : Add W0716, W0717 and W0718 functional specifications.
178
+
179
+ Tue May 29 15:04:31 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
180
+
181
+ * lib/adlint/c/interp.rb : Fix abend problem of conditional-expression
182
+ evaluation with the controlling variable's value domain management.
183
+
184
+ Tue May 29 13:11:02 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
185
+
186
+ * features/message_detection/W0013.feature : Add W0013 functional
187
+ specification.
188
+ * MANIFEST : Ditto.
189
+
190
+ Tue May 29 11:55:44 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
191
+
192
+ * lib/adlint/c/ctrlexpr.rb : Fix lack of sequence-point notification
193
+ of controlling expressions.
194
+
195
+ Mon May 28 17:42:19 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
196
+
197
+ * features/message_detection/W0010.feature : Add W0010 functional
198
+ specification.
199
+ * MANIFEST : Ditto.
200
+
201
+ Mon May 28 17:27:02 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
202
+
203
+ * lib/adlint/c/message.rb : Fix W0500 detection not to warn when two
204
+ standalone binary arithmetic expressions are appears at 2nd and 3rd
205
+ expressions of a conditional-expression.
206
+
207
+ Mon May 28 17:14:53 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
208
+
209
+ * lib/adlint/c/message.rb : Fix W0501 detection not to duplicate
210
+ warnings about a conditional-expression.
211
+
212
+ Mon May 28 13:53:09 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
213
+
214
+ * lib/adlint/c/expr.rb : Move responsibility of conditional-expression
215
+ evaluation to the upper layer in order to manage value domain of the
216
+ controlling variable.
217
+ * lib/adlint/c/interp.rb : Ditto.
218
+
219
+ Mon May 28 11:52:57 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
220
+
221
+ * features/message_detection/W0007.feature : Add W0007 functional
222
+ specification.
223
+ * MANIFEST : Ditto.
224
+
225
+ Mon May 28 11:03:47 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
226
+
227
+ * features/message_detection/W0003.feature : Add W0003 functional
228
+ specification.
229
+ * MANIFEST : Ditto.
230
+
231
+ Mon May 28 10:36:06 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
232
+
233
+ * features/message_detection/W0002.feature : Add W0002 functional
234
+ specification.
235
+ * MANIFEST : Ditto.
236
+
237
+ Mon May 27 12:35:29 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
238
+
239
+ * features/message_detection/W0001.feature : Add W0001 functional
240
+ specification.
241
+ * MANIFEST : Ditto.
242
+
243
+ Tue May 22 12:12:08 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
244
+
245
+ * features/message_detection/W0583.feature : Add W0583 functional
246
+ specification to reproduce a known bug.
247
+ * MANIFEST : Ditto.
248
+
249
+ * Rakefile : Add `features' task to run Cucumber features.
250
+
251
+ Mon May 21 16:33:19 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
252
+
253
+ * spec/adlint/c/type_spec.rb : Add unit specification of C type
254
+ models.
255
+ * MANIFEST : Ditto.
256
+
257
+ * Rakefile : Add `spec' task to run RSpec code examples.
258
+
1
259
  Fri May 18 22:04:23 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
260
 
3
261
  * release.ga : 1.8.10
@@ -502,8 +760,8 @@ Mon Apr 9 23:21:08 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
502
760
  if-else-if statement chains) metric measurement.
503
761
 
504
762
  * share/demo/Makefile : Add `incomplete_ifelse' demo.
505
- * share/demo/incomplete_ifelse/incomplete_ifelse.c : Ditto.
506
- * MANIFEST : Ditto.
763
+ * share/demo/incomplete_ifelse/incomplete_ifelse.c : Ditto.
764
+ * MANIFEST : Ditto.
507
765
 
508
766
  Mon Apr 9 20:34:51 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
509
767
 
@@ -1221,7 +1479,7 @@ Fri Mar 23 14:11:20 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
1221
1479
  Fri Mar 23 13:39:12 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
1222
1480
 
1223
1481
  * lib/adlint/c/syntax.rb : Add DeclarationSpecifiersHolder module to
1224
- commonalize accessors of DeclarationSpecifiers.
1482
+ commonalize accessors of DeclarationSpecifiers.
1225
1483
 
1226
1484
  Fri Mar 23 12:07:52 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
1227
1485
 
data/MANIFEST CHANGED
@@ -28,6 +28,25 @@ etc/conf.d/noarch/adlint_all_sh.erb
28
28
  etc/conf.d/noarch/pinit.erb
29
29
  etc/mesg.d/en_US/messages.yml
30
30
  etc/mesg.d/ja_JP/messages.yml
31
+ features/message_detection/W0001.feature
32
+ features/message_detection/W0002.feature
33
+ features/message_detection/W0003.feature
34
+ features/message_detection/W0007.feature
35
+ features/message_detection/W0010.feature
36
+ features/message_detection/W0013.feature
37
+ features/message_detection/W0109.feature
38
+ features/message_detection/W0583.feature
39
+ features/message_detection/W0606.feature
40
+ features/message_detection/W0698.feature
41
+ features/message_detection/W0699.feature
42
+ features/message_detection/W0703.feature
43
+ features/message_detection/W0716.feature
44
+ features/message_detection/W0717.feature
45
+ features/message_detection/W0718.feature
46
+ features/message_detection/W0723.feature
47
+ features/message_detection/W1031.feature
48
+ features/step_definitions/message_detection_steps.rb
49
+ features/support/env.rb
31
50
  lib/adlint.rb
32
51
  lib/adlint/analyzer.rb
33
52
  lib/adlint/c.rb
@@ -49,6 +68,7 @@ lib/adlint/c/message.rb
49
68
  lib/adlint/c/message_shima.rb
50
69
  lib/adlint/c/metric.rb
51
70
  lib/adlint/c/object.rb
71
+ lib/adlint/c/option.rb
52
72
  lib/adlint/c/parser.y
53
73
  lib/adlint/c/parser.rb
54
74
  lib/adlint/c/phase.rb
@@ -483,4 +503,8 @@ share/sample/zsh-4.3.15/adlint/zle/GNUmakefile
483
503
  share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h
484
504
  share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h
485
505
  share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml
486
- spec/MUST_WRITE_SPECS_WITH_RSPEC
506
+ spec/spec_helper.rb
507
+ spec/adlint/c/type_spec.rb
508
+ spec/conf.d/empty_cinit.h
509
+ spec/conf.d/empty_pinit.h
510
+ spec/conf.d/default_traits.yml
data/NEWS CHANGED
@@ -21,6 +21,30 @@
21
21
 
22
22
  ++
23
23
 
24
+ === \AdLint 1.10.0 is released (2012-06-06)
25
+
26
+ ==== Changes since the 1.8.10 release
27
+
28
+ * Add W0716 detection
29
+ * Add W0717 detection
30
+ * Add W0718 detection
31
+ * Fix W0500 detection not to warn when two standalone binary arithmetic
32
+ expressions are appears at 2nd and 3rd expressions of a
33
+ conditional-expression
34
+ * Fix W0501 detection not to duplicate warnings about a conditional-expression
35
+ * Fix W0582, W0583 and W0584 detections in order to consider type
36
+ convertibility correctly
37
+ * Fix W1031 detection not to warn when the declaration with `static' and
38
+ definition without storage-class-specifier
39
+ * Fix lack of sequence-point notification of controlling expressions
40
+ * Add unit specification of C type models
41
+ * Add W0001, W0002, W0003, W0007, W0010, W0013, W0109, W0583, W0606, W0698,
42
+ W0699, W0703, W0716, W0717, W0718, W0723 and W1031 functional specifications
43
+
44
+ See the file
45
+ {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
46
+ for more details.
47
+
24
48
  === \AdLint 1.8.10 is released (2012-05-18)
25
49
 
26
50
  ==== Changes since the 1.8.2 release
@@ -32,7 +56,7 @@
32
56
  pointer type whose base type is cv-qualified
33
57
  * Fix W0583 detection not to warn when the argument type is a cv-qualified one
34
58
  of the corresponding parameter's type
35
- * Fix W0112 detection not to warn about floating point relational-expressions.
59
+ * Fix W0112 detection not to warn about floating point relational-expressions
36
60
  * Fix W0117 and W0118 detection not to misunderstand linkage of object
37
61
  definitions
38
62
  * Fix W0101, W0102, W0103 and W0107 detections not to warn when an address of
@@ -57,10 +81,6 @@
57
81
  * Fix degraded W0118 detection to warn when all declarations of an object are
58
82
  in the source file
59
83
 
60
- See the file
61
- {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
62
- for more details.
63
-
64
84
  === \AdLint 1.8.2 is released (2012-05-08)
65
85
 
66
86
  ==== Changes since the 1.8.0 release
data/Rakefile CHANGED
@@ -23,6 +23,8 @@
23
23
 
24
24
  require "rubygems/package_task"
25
25
  require "rdoc/task"
26
+ require "rspec/core/rake_task"
27
+ require "cucumber/rake/task"
26
28
 
27
29
  $: << File.expand_path("lib", File.dirname(__FILE__))
28
30
  require "adlint/version"
@@ -136,6 +138,15 @@ task :clobber => :clean do
136
138
  rm_f "tags"
137
139
  end
138
140
 
141
+ RSpec::Core::RakeTask.new(:spec) do |t|
142
+ t.ruby_opts = %w(-w)
143
+ t.rspec_opts = %w(-f html -o spec.html)
144
+ end
145
+
146
+ Cucumber::Rake::Task.new(:features) do |t|
147
+ t.cucumber_opts = %w(--strict --quiet -f html -o features.html)
148
+ end
149
+
139
150
  def racc(files)
140
151
  files.each do |file|
141
152
  sh "racc #{file} -o #{File.basename(file, ".y")}.rb"
data/TODO CHANGED
@@ -21,7 +21,6 @@
21
21
 
22
22
  ++
23
23
 
24
- * Write unit and functional tests with RSpec
25
24
  * Support many more preset build environments
26
25
  * Implement automatic traits files generator
27
26
  * Improve performance
@@ -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.8.10"
39
+ version: "1.10.0"
40
40
 
41
41
  message_definition:
42
42
  X0001: "An unknown exception `%s' is found."
@@ -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.8.10"
39
+ version: "1.10.0"
40
40
 
41
41
  message_definition:
42
42
  X0001: "不明な例外条件 `%s' を検出しました。"
@@ -0,0 +1,41 @@
1
+ Feature: W0001
2
+
3
+ W0001 detects that a number of the expression grouping is greater than 32.
4
+
5
+ Scenario: deeply grouped in initializer
6
+ Given a target source named "W0001.c" with:
7
+ """
8
+ static void foo(void)
9
+ {
10
+ const int a = 10;
11
+ const int b = 20;
12
+ const int c = (((((((((((((((((((((((((((((((((a + b))))))))))))))))))))))))))))))))); /* W0001 */
13
+ }
14
+ """
15
+ When I successfully run `adlint W0001.c` on noarch
16
+ Then the output should exactly match with:
17
+ | mesg | line | column |
18
+ | W0629 | 1 | 13 |
19
+ | W0001 | 5 | 51 |
20
+ | W0628 | 1 | 13 |
21
+
22
+ Scenario: deeply grouped in expression-statement
23
+ Given a target source named "W0001.c" with:
24
+ """
25
+ static void foo(void)
26
+ {
27
+ const int a = 10;
28
+ const int b = 20;
29
+ int c;
30
+ c = (((((((((((((((((((((((((((((((((a + b))))))))))))))))))))))))))))))))); /* W0001 */
31
+ }
32
+ """
33
+ When I successfully run `adlint W0001.c` on noarch
34
+ Then the output should exactly match with:
35
+ | mesg | line | column |
36
+ | W0100 | 5 | 9 |
37
+ | W0629 | 1 | 13 |
38
+ | W0001 | 6 | 41 |
39
+ | W0628 | 1 | 13 |
40
+
41
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,68 @@
1
+ Feature: W0002
2
+
3
+ W0002 detects that an old style function-definition is found.
4
+
5
+ Scenario: all arguments are type specified
6
+ Given a target source named "W0002.c" with:
7
+ """
8
+ int func(arg1, arg2) /* W0002 */
9
+ int arg1;
10
+ char arg2;
11
+ {
12
+ return 0;
13
+ }
14
+ """
15
+ When I successfully run `adlint W0002.c` on noarch
16
+ Then the output should exactly match with:
17
+ | mesg | line | column |
18
+ | W0117 | 1 | 5 |
19
+ | W0031 | 2 | 5 |
20
+ | W0031 | 3 | 6 |
21
+ | W0104 | 2 | 5 |
22
+ | W0104 | 3 | 6 |
23
+ | W0002 | 1 | 5 |
24
+ | W0628 | 1 | 5 |
25
+
26
+ Scenario: no arguments are type specified
27
+ Given a target source named "W0002.c" with:
28
+ """
29
+ int func(arg1, arg2) /* W0002 */
30
+ {
31
+ return 0;
32
+ }
33
+ """
34
+ When I successfully run `adlint W0002.c` on noarch
35
+ Then the output should exactly match with:
36
+ | mesg | line | column |
37
+ | W0117 | 1 | 5 |
38
+ | W0031 | 1 | 10 |
39
+ | W0031 | 1 | 16 |
40
+ | W0104 | 1 | 10 |
41
+ | W0104 | 1 | 16 |
42
+ | W0002 | 1 | 5 |
43
+ | W0458 | 1 | 10 |
44
+ | W0458 | 1 | 16 |
45
+ | W0628 | 1 | 5 |
46
+
47
+ Scenario: arguments are partly type specified
48
+ Given a target source named "W0002.c" with:
49
+ """
50
+ int func(arg1, arg2) /* W0002 */
51
+ char arg2;
52
+ {
53
+ return 0;
54
+ }
55
+ """
56
+ When I successfully run `adlint W0002.c` on noarch
57
+ Then the output should exactly match with:
58
+ | mesg | line | column |
59
+ | W0117 | 1 | 5 |
60
+ | W0031 | 1 | 10 |
61
+ | W0031 | 2 | 6 |
62
+ | W0104 | 1 | 10 |
63
+ | W0104 | 2 | 6 |
64
+ | W0002 | 1 | 5 |
65
+ | W0458 | 1 | 10 |
66
+ | W0628 | 1 | 5 |
67
+
68
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,134 @@
1
+ Feature: W0003
2
+
3
+ W0003 detects that no default clause is in the switch-statement.
4
+
5
+ Scenario: no default clause
6
+ Given a target source named "W0003.c" with:
7
+ """
8
+ int foo(int i)
9
+ {
10
+ int j;
11
+
12
+ switch(i) { /* W0003 */
13
+ case 1:
14
+ j = 1;
15
+ break;
16
+ case 2:
17
+ j = 2;
18
+ break;
19
+ case 3:
20
+ j = 3;
21
+ break;
22
+ }
23
+
24
+ return j;
25
+ }
26
+ """
27
+ When I successfully run `adlint W0003.c` on noarch
28
+ Then the output should exactly match with:
29
+ | mesg | line | column |
30
+ | W0117 | 1 | 5 |
31
+ | W0460 | 17 | 12 |
32
+ | W0104 | 1 | 13 |
33
+ | W0003 | 5 | 5 |
34
+ | W0628 | 1 | 5 |
35
+
36
+ Scenario: a default clause at the bottom
37
+ Given a target source named "W0003.c" with:
38
+ """
39
+ int foo(int i)
40
+ {
41
+ int j;
42
+
43
+ switch(i) { /* OK */
44
+ case 1:
45
+ j = 1;
46
+ break;
47
+ case 2:
48
+ j = 2;
49
+ break;
50
+ case 3:
51
+ j = 3;
52
+ break;
53
+ default:
54
+ j = 4;
55
+ break;
56
+ }
57
+
58
+ return j;
59
+ }
60
+ """
61
+ When I successfully run `adlint W0003.c` on noarch
62
+ Then the output should exactly match with:
63
+ | mesg | line | column |
64
+ | W0117 | 1 | 5 |
65
+ | W0104 | 1 | 13 |
66
+ | W0628 | 1 | 5 |
67
+
68
+ Scenario: a default clause at the middle
69
+ Given a target source named "W0003.c" with:
70
+ """
71
+ int foo(int i)
72
+ {
73
+ int j;
74
+
75
+ switch(i) { /* OK */
76
+ case 1:
77
+ j = 1;
78
+ break;
79
+ default:
80
+ j = 4;
81
+ break;
82
+ case 2:
83
+ j = 2;
84
+ break;
85
+ case 3:
86
+ j = 3;
87
+ break;
88
+ }
89
+
90
+ return j;
91
+ }
92
+ """
93
+ When I successfully run `adlint W0003.c` on noarch
94
+ Then the output should exactly match with:
95
+ | mesg | line | column |
96
+ | W0117 | 1 | 5 |
97
+ | W0104 | 1 | 13 |
98
+ | W0538 | 9 | 5 |
99
+ | W0628 | 1 | 5 |
100
+
101
+ Scenario: a default clause at the top
102
+ Given a target source named "W0003.c" with:
103
+ """
104
+ int foo(int i)
105
+ {
106
+ int j;
107
+
108
+ switch(i) { /* OK */
109
+ default:
110
+ j = 4;
111
+ break;
112
+ case 1:
113
+ j = 1;
114
+ break;
115
+ case 2:
116
+ j = 2;
117
+ break;
118
+ case 3:
119
+ j = 3;
120
+ break;
121
+ }
122
+
123
+ return j;
124
+ }
125
+ """
126
+ When I successfully run `adlint W0003.c` on noarch
127
+ Then the output should exactly match with:
128
+ | mesg | line | column |
129
+ | W0117 | 1 | 5 |
130
+ | W0104 | 1 | 13 |
131
+ | W0538 | 6 | 5 |
132
+ | W0628 | 1 | 5 |
133
+
134
+ # vim:ts=2:sw=2:sts=2:et: