adlint 3.0.8 → 3.0.10

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 +295 -0
  2. data/MANIFEST +9 -0
  3. data/NEWS +25 -4
  4. data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
  5. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
  6. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  7. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  8. data/features/code_check/E0008.feature +20 -0
  9. data/features/code_check/W0093.feature +1 -1
  10. data/features/code_check/W0097.feature +30 -0
  11. data/features/code_check/W0100.feature +66 -0
  12. data/features/code_check/W0422.feature +157 -0
  13. data/features/code_check/W0459.feature +118 -0
  14. data/features/code_check/W0461.feature +115 -0
  15. data/features/code_check/W0610.feature +59 -0
  16. data/features/code_check/W0612.feature +29 -0
  17. data/features/code_check/W0613.feature +33 -0
  18. data/features/code_check/W0704.feature +25 -0
  19. data/features/code_check/W0705.feature +33 -0
  20. data/features/code_check/W1050.feature +43 -0
  21. data/features/code_check/W1071.feature +30 -0
  22. data/features/code_check/W9001.feature +24 -0
  23. data/lib/adlint/cc1/branch.rb +32 -9
  24. data/lib/adlint/cc1/builtin.rb +2 -2
  25. data/lib/adlint/cc1/conv.rb +33 -33
  26. data/lib/adlint/cc1/ctrlexpr.rb +30 -30
  27. data/lib/adlint/cc1/domain.rb +12 -4
  28. data/lib/adlint/cc1/environ.rb +2 -1
  29. data/lib/adlint/cc1/expr.rb +135 -125
  30. data/lib/adlint/cc1/format.rb +3 -3
  31. data/lib/adlint/cc1/interp.rb +123 -109
  32. data/lib/adlint/cc1/lexer.rb +44 -40
  33. data/lib/adlint/cc1/mediator.rb +2 -2
  34. data/lib/adlint/cc1/object.rb +121 -36
  35. data/lib/adlint/cc1/option.rb +1 -0
  36. data/lib/adlint/cc1/parser.rb +874 -845
  37. data/lib/adlint/cc1/parser.y +22 -2
  38. data/lib/adlint/cc1/syntax.rb +37 -18
  39. data/lib/adlint/cc1/type.rb +3 -3
  40. data/lib/adlint/cc1/value.rb +58 -50
  41. data/lib/adlint/cpp/lexer.rb +5 -1
  42. data/lib/adlint/cpp/macro.rb +30 -30
  43. data/lib/adlint/cpp/subst.rb +4 -4
  44. data/lib/adlint/exam/c_builtin/cc1_check.rb +172 -172
  45. data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +11 -11
  46. data/lib/adlint/exam/c_builtin/cpp_check.rb +2 -2
  47. data/lib/adlint/memo.rb +13 -13
  48. data/lib/adlint/prelude.rb +2 -2
  49. data/lib/adlint/version.rb +2 -2
  50. data/share/doc/developers_guide_ja.html +7 -5
  51. data/share/doc/developers_guide_ja.texi +5 -3
  52. data/share/doc/users_guide_en.html +3 -3
  53. data/share/doc/users_guide_en.texi +1 -1
  54. data/share/doc/users_guide_ja.html +3 -3
  55. data/share/doc/users_guide_ja.texi +1 -1
  56. metadata +11 -2
@@ -797,13 +797,13 @@ module CBuiltin #:nodoc:
797
797
  end
798
798
 
799
799
  private
800
- def check(*, org_var, res_var)
801
- if @rvalues && org_var.type.floating?
802
- case expr = @rvalues[org_var]
803
- when Cc1::AdditiveExpression, Cc1::MultiplicativeExpression
804
- if org_var.type.same_as?(from_type) && res_var.type.same_as?(to_type)
805
- W(expr.location)
806
- end
800
+ def check(*, orig_var, rslt_var)
801
+ return unless @rvalues && orig_var.type.floating?
802
+
803
+ case expr = @rvalues[orig_var]
804
+ when Cc1::AdditiveExpression, Cc1::MultiplicativeExpression
805
+ if orig_var.type.same_as?(from_type) && rslt_var.type.same_as?(to_type)
806
+ W(expr.location)
807
807
  end
808
808
  end
809
809
  end
@@ -812,13 +812,13 @@ module CBuiltin #:nodoc:
812
812
  @rvalues = {}
813
813
  end
814
814
 
815
- def handle_additive(expr, *, res_var)
816
- memorize_rvalue_derivation(res_var, expr)
815
+ def handle_additive(expr, *, rslt_var)
816
+ memorize_rvalue_derivation(rslt_var, expr)
817
817
  end
818
818
 
819
- def handle_multiplicative(expr, *, res_var)
819
+ def handle_multiplicative(expr, *, rslt_var)
820
820
  unless expr.operator.type == "%"
821
- memorize_rvalue_derivation(res_var, expr)
821
+ memorize_rvalue_derivation(rslt_var, expr)
822
822
  end
823
823
  end
824
824
 
@@ -1253,8 +1253,8 @@ module CBuiltin #:nodoc:
1253
1253
  end
1254
1254
 
1255
1255
  private
1256
- def check(*, res_toks)
1257
- if defined_tok = res_toks.find { |tok| tok.value == "defined" }
1256
+ def check(*, rslt_toks)
1257
+ if defined_tok = rslt_toks.find { |tok| tok.value == "defined" }
1258
1258
  W(defined_tok.location)
1259
1259
  end
1260
1260
  end
data/lib/adlint/memo.rb CHANGED
@@ -61,10 +61,10 @@ module AdLint #:nodoc:
61
61
  else
62
62
  if #{cache_name_of(name)}_forbidden ||= false
63
63
  #{cache_name_of(name)}_forbidden = false
64
- #{org_name_of(name)}
64
+ #{orig_name_of(name)}
65
65
  else
66
66
  #{cache_name_of(name)}_initialized = true
67
- #{cache_name_of(name)} = #{org_name_of(name)}(*args)
67
+ #{cache_name_of(name)} = #{orig_name_of(name)}(*args)
68
68
  end
69
69
  end
70
70
  end
@@ -82,16 +82,16 @@ module AdLint #:nodoc:
82
82
  if #{cache_name_of(name)}.include?(key)
83
83
  #{cache_name_of(name)}[key]
84
84
  else
85
- #{cache_name_of(name)}[key] = #{org_name_of(name)}(*args)
85
+ #{cache_name_of(name)}[key] = #{orig_name_of(name)}(*args)
86
86
  end
87
87
  else
88
88
  if #{cache_name_of(name)}_forbidden ||= false
89
89
  #{cache_name_of(name)}_forbidden = false
90
- #{org_name_of(name)}(*args)
90
+ #{orig_name_of(name)}(*args)
91
91
  else
92
92
  #{cache_name_of(name)}_initialized = true
93
93
  #{cache_name_of(name)} = {}
94
- #{cache_name_of(name)}[key] = #{org_name_of(name)}(*args)
94
+ #{cache_name_of(name)}[key] = #{orig_name_of(name)}(*args)
95
95
  end
96
96
  end
97
97
  end
@@ -109,16 +109,16 @@ module AdLint #:nodoc:
109
109
  if #{cache_name_of(name)}.include?(key)
110
110
  #{cache_name_of(name)}[key]
111
111
  else
112
- #{cache_name_of(name)}[key] = #{org_name_of(name)}(*args)
112
+ #{cache_name_of(name)}[key] = #{orig_name_of(name)}(*args)
113
113
  end
114
114
  else
115
115
  if #{cache_name_of(name)}_forbidden ||= false
116
116
  #{cache_name_of(name)}_forbidden = false
117
- #{org_name_of(name)}(*args)
117
+ #{orig_name_of(name)}(*args)
118
118
  else
119
119
  #{cache_name_of(name)}_initialized = true
120
120
  #{cache_name_of(name)} = {}
121
- #{cache_name_of(name)}[key] = #{org_name_of(name)}(*args)
121
+ #{cache_name_of(name)}[key] = #{orig_name_of(name)}(*args)
122
122
  end
123
123
  end
124
124
  end
@@ -194,17 +194,17 @@ module AdLint #:nodoc:
194
194
 
195
195
  def save_memoizing_method(name)
196
196
  class_eval <<-EOS
197
- alias_method(:#{org_name_of(name)}, :#{name})
198
- private(:#{org_name_of(name)})
197
+ alias_method(:#{orig_name_of(name)}, :#{name})
198
+ private(:#{orig_name_of(name)})
199
199
  EOS
200
200
  end
201
201
 
202
202
  def cache_name_of(name)
203
- "@__cache_of__#{name.to_s.sub("?", "P")}"
203
+ "@__cache_of__#{name.to_s.sub("?", "_p")}"
204
204
  end
205
205
 
206
- def org_name_of(name)
207
- "__org_#{name}"
206
+ def orig_name_of(name)
207
+ "__orig_#{name}"
208
208
  end
209
209
  end
210
210
 
@@ -327,9 +327,9 @@ end
327
327
  # string_item: "foo${VAR}baz"
328
328
  #
329
329
  class Psych::TreeBuilder < Psych::Handler
330
- alias :_org_scalar :scalar
330
+ alias :_orig_scalar :scalar
331
331
  def scalar(value, anchor, tag, plain, quoted, style)
332
- _org_scalar(substitute_environment_variables(value),
332
+ _orig_scalar(substitute_environment_variables(value),
333
333
  anchor, tag, plain, quoted, style)
334
334
  end
335
335
 
@@ -33,8 +33,8 @@ module AdLint #:nodoc:
33
33
 
34
34
  MAJOR_VERSION = 3
35
35
  MINOR_VERSION = 0
36
- PATCH_VERSION = 8
37
- RELEASE_DATE = "2013-05-31"
36
+ PATCH_VERSION = 10
37
+ RELEASE_DATE = "2013-06-28"
38
38
 
39
39
  TRAITS_SCHEMA_VERSION = "3.0.0"
40
40
 
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 3.0.8 開発者ガイド</title>
3
+ <title>AdLint 3.0.10 開発者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 3.0.8 開発者ガイド">
5
+ <meta name="description" content="AdLint 3.0.10 開発者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 3.0.8 開発者ガイド</h1>
47
+ <h1 class="settitle">AdLint 3.0.10 開発者ガイド</h1>
48
48
  <div class="contents">
49
49
  <h2>Table of Contents</h2>
50
50
  <ul>
@@ -169,7 +169,7 @@ definition -> def
169
169
  enumerator -> enum
170
170
  member -> memb
171
171
  element -> elem
172
- original -> org
172
+ original -> orig
173
173
  converted -> conved
174
174
  conversion -> conv
175
175
  arithmetic -> arith
@@ -275,7 +275,7 @@ logical-or -> lor
275
275
  relationship -> relat
276
276
  prototype -> proto
277
277
  termination -> term
278
- result -> res
278
+ result -> rslt
279
279
  operand -> ope
280
280
  domain -> dom
281
281
  qualified -> qualed
@@ -283,6 +283,8 @@ error -> err
283
283
  project -> proj
284
284
  temporary -> tmp
285
285
  referrer-function -> ref_fun
286
+ sample -> smpl
287
+ representative -> repr
286
288
  </pre>
287
289
 
288
290
  <div class="node">
@@ -2,7 +2,7 @@
2
2
  @setfilename developers_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 3.0.8 開発者ガイド
5
+ @settitle AdLint 3.0.10 開発者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
@@ -98,7 +98,7 @@ definition -> def
98
98
  enumerator -> enum
99
99
  member -> memb
100
100
  element -> elem
101
- original -> org
101
+ original -> orig
102
102
  converted -> conved
103
103
  conversion -> conv
104
104
  arithmetic -> arith
@@ -204,7 +204,7 @@ logical-or -> lor
204
204
  relationship -> relat
205
205
  prototype -> proto
206
206
  termination -> term
207
- result -> res
207
+ result -> rslt
208
208
  operand -> ope
209
209
  domain -> dom
210
210
  qualified -> qualed
@@ -212,6 +212,8 @@ error -> err
212
212
  project -> proj
213
213
  temporary -> tmp
214
214
  referrer-function -> ref_fun
215
+ sample -> smpl
216
+ representative -> repr
215
217
  @end verbatim
216
218
 
217
219
 
@@ -1,8 +1,8 @@
1
1
  <html lang="en">
2
2
  <head>
3
- <title>AdLint 3.0.8 User's Guide</title>
3
+ <title>AdLint 3.0.10 User's Guide</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 3.0.8 User's Guide">
5
+ <meta name="description" content="AdLint 3.0.10 User's Guide">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 3.0.8 User's Guide</h1>
47
+ <h1 class="settitle">AdLint 3.0.10 User's Guide</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_en.info
3
3
  @documentlanguage en
4
4
  @documentencoding utf-8
5
- @settitle AdLint 3.0.8 User's Guide
5
+ @settitle AdLint 3.0.10 User's Guide
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 3.0.8 利用者ガイド</title>
3
+ <title>AdLint 3.0.10 利用者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 3.0.8 利用者ガイド">
5
+ <meta name="description" content="AdLint 3.0.10 利用者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 3.0.8 利用者ガイド</h1>
47
+ <h1 class="settitle">AdLint 3.0.10 利用者ガイド</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 3.0.8 利用者ガイド
5
+ @settitle AdLint 3.0.10 利用者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-31 00:00:00.000000000 Z
12
+ date: 2013-06-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'AdLint is a source code static analyzer.
15
15
 
@@ -65,6 +65,7 @@ files:
65
65
  - etc/mesg.d/c_builtin/ja_JP/messages.yml
66
66
  - etc/mesg.d/core/en_US/messages.yml
67
67
  - etc/mesg.d/core/ja_JP/messages.yml
68
+ - features/code_check/E0008.feature
68
69
  - features/code_check/E0013.feature
69
70
  - features/code_check/W0001.feature
70
71
  - features/code_check/W0002.feature
@@ -85,6 +86,8 @@ files:
85
86
  - features/code_check/W0071.feature
86
87
  - features/code_check/W0088.feature
87
88
  - features/code_check/W0093.feature
89
+ - features/code_check/W0097.feature
90
+ - features/code_check/W0100.feature
88
91
  - features/code_check/W0104.feature
89
92
  - features/code_check/W0109.feature
90
93
  - features/code_check/W0119.feature
@@ -227,7 +230,9 @@ files:
227
230
  - features/code_check/W0425.feature
228
231
  - features/code_check/W0431.feature
229
232
  - features/code_check/W0432.feature
233
+ - features/code_check/W0459.feature
230
234
  - features/code_check/W0460.feature
235
+ - features/code_check/W0461.feature
231
236
  - features/code_check/W0477.feature
232
237
  - features/code_check/W0478.feature
233
238
  - features/code_check/W0479.feature
@@ -260,6 +265,8 @@ files:
260
265
  - features/code_check/W0606.feature
261
266
  - features/code_check/W0610.feature
262
267
  - features/code_check/W0611.feature
268
+ - features/code_check/W0612.feature
269
+ - features/code_check/W0613.feature
263
270
  - features/code_check/W0635.feature
264
271
  - features/code_check/W0641.feature
265
272
  - features/code_check/W0642.feature
@@ -285,6 +292,7 @@ files:
285
292
  - features/code_check/W0699.feature
286
293
  - features/code_check/W0700.feature
287
294
  - features/code_check/W0703.feature
295
+ - features/code_check/W0704.feature
288
296
  - features/code_check/W0705.feature
289
297
  - features/code_check/W0707.feature
290
298
  - features/code_check/W0708.feature
@@ -354,6 +362,7 @@ files:
354
362
  - features/code_check/W1041.feature
355
363
  - features/code_check/W1046.feature
356
364
  - features/code_check/W1047.feature
365
+ - features/code_check/W1050.feature
357
366
  - features/code_check/W1052.feature
358
367
  - features/code_check/W1057.feature
359
368
  - features/code_check/W1058.feature