adlint 3.2.0 → 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +1 -2
  3. data/ChangeLog +196 -5236
  4. data/INSTALL +1 -1
  5. data/MANIFEST +4 -2
  6. data/NEWS +30 -13
  7. data/README +2 -2
  8. data/Rakefile +2 -2
  9. data/TODO +1 -1
  10. data/bin/adlint +2 -2
  11. data/bin/adlint_chk +2 -2
  12. data/bin/adlint_cma +2 -2
  13. data/bin/adlint_sma +2 -2
  14. data/bin/adlintize +2 -2
  15. data/etc/conf.d/fallback/cinit.erb +1 -1
  16. data/etc/conf.d/fallback/traits.erb +1 -1
  17. data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
  18. data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +1 -1
  19. data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
  20. data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +1 -1
  21. data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
  22. data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +1 -1
  23. data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
  24. data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +1 -1
  25. data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
  26. data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
  27. data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
  28. data/etc/conf.d/noarch/pinit.erb +1 -1
  29. data/etc/conf.d/x86_64-centos_6.4/cinit-gcc_4.4.7.erb +150 -0
  30. data/etc/conf.d/x86_64-centos_6.4/traits-gcc_4.4.7.erb +290 -0
  31. data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
  32. data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +1 -1
  33. data/etc/mesg.d/c_builtin/en_US/messages.yml +2 -2
  34. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +3 -3
  35. data/etc/mesg.d/core/en_US/messages.yml +6 -2
  36. data/etc/mesg.d/core/ja_JP/messages.yml +6 -2
  37. data/features/code_check/E0008.feature +122 -0
  38. data/features/code_check/E0016.feature +49 -0
  39. data/features/code_check/E0018.feature +99 -0
  40. data/features/code_check/W0460.feature +8 -8
  41. data/lib/adlint.rb +2 -2
  42. data/lib/adlint/analyzer.rb +2 -2
  43. data/lib/adlint/annot.rb +2 -2
  44. data/lib/adlint/cc1.rb +2 -2
  45. data/lib/adlint/cc1/branch.rb +2 -2
  46. data/lib/adlint/cc1/builtin.rb +2 -2
  47. data/lib/adlint/cc1/const.rb +2 -2
  48. data/lib/adlint/cc1/conv.rb +2 -2
  49. data/lib/adlint/cc1/ctrlexpr.rb +2 -2
  50. data/lib/adlint/cc1/domain.rb +2 -2
  51. data/lib/adlint/cc1/enum.rb +2 -2
  52. data/lib/adlint/cc1/environ.rb +2 -2
  53. data/lib/adlint/cc1/expr.rb +110 -48
  54. data/lib/adlint/cc1/format.rb +2 -2
  55. data/lib/adlint/cc1/interp.rb +46 -12
  56. data/lib/adlint/cc1/lexer.rb +44 -11
  57. data/lib/adlint/cc1/mediator.rb +16 -2
  58. data/lib/adlint/cc1/object.rb +2 -2
  59. data/lib/adlint/cc1/operator.rb +2 -2
  60. data/lib/adlint/cc1/option.rb +3 -3
  61. data/lib/adlint/cc1/parser.rb +1011 -999
  62. data/lib/adlint/cc1/parser.y +20 -11
  63. data/lib/adlint/cc1/phase.rb +2 -2
  64. data/lib/adlint/cc1/resolver.rb +2 -2
  65. data/lib/adlint/cc1/scanner.rb +2 -2
  66. data/lib/adlint/cc1/scope.rb +2 -2
  67. data/lib/adlint/cc1/seqp.rb +2 -2
  68. data/lib/adlint/cc1/syntax.rb +42 -10
  69. data/lib/adlint/cc1/trace.rb +2 -2
  70. data/lib/adlint/cc1/type.rb +72 -2
  71. data/lib/adlint/cc1/util.rb +2 -2
  72. data/lib/adlint/cc1/value.rb +9 -3
  73. data/lib/adlint/code.rb +2 -2
  74. data/lib/adlint/cpp.rb +2 -2
  75. data/lib/adlint/cpp/asm.rb +2 -2
  76. data/lib/adlint/cpp/constexpr.rb +1 -1
  77. data/lib/adlint/cpp/constexpr.y +2 -2
  78. data/lib/adlint/cpp/eval.rb +2 -2
  79. data/lib/adlint/cpp/lexer.rb +13 -3
  80. data/lib/adlint/cpp/macro.rb +2 -2
  81. data/lib/adlint/cpp/phase.rb +2 -2
  82. data/lib/adlint/cpp/scanner.rb +2 -2
  83. data/lib/adlint/cpp/source.rb +2 -2
  84. data/lib/adlint/cpp/subst.rb +6 -2
  85. data/lib/adlint/cpp/syntax.rb +2 -2
  86. data/lib/adlint/cpp/util.rb +2 -2
  87. data/lib/adlint/driver.rb +2 -2
  88. data/lib/adlint/error.rb +2 -2
  89. data/lib/adlint/exam.rb +20 -8
  90. data/lib/adlint/exam/c_builtin.rb +4 -6
  91. data/lib/adlint/exam/c_builtin/cc1_check.rb +1380 -461
  92. data/lib/adlint/exam/c_builtin/cc1_code.rb +25 -25
  93. data/lib/adlint/exam/c_builtin/cc1_metric.rb +180 -209
  94. data/lib/adlint/exam/c_builtin/cpp_check.rb +211 -50
  95. data/lib/adlint/exam/c_builtin/cpp_code.rb +19 -19
  96. data/lib/adlint/exam/c_builtin/ld_check.rb +2 -2
  97. data/lib/adlint/exam/c_builtin/ld_metric.rb +2 -2
  98. data/lib/adlint/lang.rb +2 -2
  99. data/lib/adlint/ld.rb +2 -2
  100. data/lib/adlint/ld/object.rb +3 -3
  101. data/lib/adlint/ld/phase.rb +2 -2
  102. data/lib/adlint/ld/typedef.rb +2 -2
  103. data/lib/adlint/ld/util.rb +2 -2
  104. data/lib/adlint/lexer.rb +2 -2
  105. data/lib/adlint/location.rb +2 -2
  106. data/lib/adlint/memo.rb +2 -2
  107. data/lib/adlint/message.rb +2 -2
  108. data/lib/adlint/metric.rb +2 -2
  109. data/lib/adlint/monitor.rb +2 -2
  110. data/lib/adlint/phase.rb +2 -2
  111. data/lib/adlint/prelude.rb +2 -2
  112. data/lib/adlint/report.rb +4 -4
  113. data/lib/adlint/source.rb +2 -2
  114. data/lib/adlint/supp.rb +2 -2
  115. data/lib/adlint/symbol.rb +2 -2
  116. data/lib/adlint/token.rb +2 -2
  117. data/lib/adlint/traits.rb +2 -2
  118. data/lib/adlint/util.rb +2 -2
  119. data/lib/adlint/version.rb +6 -6
  120. data/share/HEADER +2 -2
  121. data/share/doc/developers_guide_ja.html +20 -9
  122. data/share/doc/developers_guide_ja.texi +18 -7
  123. data/share/doc/samples/GNUmakefile +1 -1
  124. data/share/doc/samples/adlint_traits.yml +1 -1
  125. data/share/doc/users_guide_en.html +6177 -6138
  126. data/share/doc/users_guide_en.texi +35 -5
  127. data/share/doc/users_guide_ja.html +6192 -6153
  128. data/share/doc/users_guide_ja.texi +35 -5
  129. data/share/sample/bison-2.5/adlint/GNUmakefile +1 -1
  130. data/share/sample/bison-2.5/adlint/adlint_traits.yml +1 -1
  131. data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
  132. data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
  133. data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
  134. data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +1 -1
  135. data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
  136. data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
  137. data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
  138. data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +1 -1
  139. data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
  140. data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
  141. data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
  142. data/share/sample/ctags-5.8/adlint/adlint_traits.yml +1 -1
  143. data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
  144. data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
  145. data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
  146. data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +1 -1
  147. data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
  148. data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +1 -1
  149. data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
  150. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
  151. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
  152. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +1 -1
  153. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
  154. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
  155. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
  156. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +1 -1
  157. data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
  158. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
  159. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
  160. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +1 -1
  161. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
  162. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
  163. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
  164. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +1 -1
  165. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
  166. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
  167. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
  168. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +1 -1
  169. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
  170. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
  171. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
  172. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +1 -1
  173. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
  174. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
  175. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
  176. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +1 -1
  177. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
  178. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
  179. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
  180. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +1 -1
  181. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
  182. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
  183. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
  184. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +1 -1
  185. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
  186. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
  187. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
  188. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +1 -1
  189. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
  190. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
  191. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
  192. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +1 -1
  193. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
  194. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
  195. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
  196. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +1 -1
  197. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
  198. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
  199. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
  200. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +1 -1
  201. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
  202. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
  203. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
  204. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +1 -1
  205. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
  206. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
  207. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
  208. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +1 -1
  209. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
  210. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
  211. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
  212. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +1 -1
  213. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
  214. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
  215. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
  216. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +1 -1
  217. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
  218. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
  219. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
  220. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +1 -1
  221. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
  222. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
  223. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
  224. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +1 -1
  225. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
  226. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
  227. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
  228. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +1 -1
  229. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
  230. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
  231. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
  232. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +1 -1
  233. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
  234. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
  235. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
  236. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +1 -1
  237. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
  238. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
  239. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
  240. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +1 -1
  241. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
  242. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
  243. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
  244. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +1 -1
  245. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
  246. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
  247. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
  248. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +1 -1
  249. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
  250. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
  251. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
  252. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +1 -1
  253. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
  254. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
  255. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
  256. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +1 -1
  257. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
  258. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
  259. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
  260. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +1 -1
  261. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
  262. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
  263. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
  264. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +1 -1
  265. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
  266. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
  267. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
  268. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +1 -1
  269. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
  270. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
  271. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
  272. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +1 -1
  273. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
  274. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
  275. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
  276. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +1 -1
  277. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
  278. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
  279. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
  280. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +1 -1
  281. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
  282. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
  283. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
  284. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +1 -1
  285. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
  286. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
  287. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
  288. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +1 -1
  289. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
  290. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
  291. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
  292. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +1 -1
  293. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
  294. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
  295. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
  296. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +1 -1
  297. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
  298. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
  299. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
  300. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +1 -1
  301. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
  302. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
  303. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
  304. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +1 -1
  305. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
  306. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
  307. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
  308. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +1 -1
  309. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
  310. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
  311. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
  312. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +1 -1
  313. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
  314. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
  315. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
  316. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +1 -1
  317. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
  318. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
  319. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
  320. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +1 -1
  321. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
  322. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
  323. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
  324. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +1 -1
  325. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
  326. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
  327. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
  328. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +1 -1
  329. data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
  330. data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
  331. data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
  332. data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +1 -1
  333. data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
  334. data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
  335. data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
  336. data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +1 -1
  337. data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
  338. data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
  339. data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
  340. data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +1 -1
  341. data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
  342. data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +1 -1
  343. data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
  344. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
  345. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
  346. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +1 -1
  347. data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
  348. data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
  349. data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
  350. data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +1 -1
  351. data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
  352. data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
  353. data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
  354. data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +1 -1
  355. data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
  356. data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
  357. data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
  358. data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +1 -1
  359. data/spec/adlint/cc1/ctrlexpr_spec.rb +3 -3
  360. data/spec/adlint/cc1/domain_spec.rb +2 -2
  361. data/spec/adlint/cc1/operator_spec.rb +2 -2
  362. data/spec/adlint/cc1/syntax_spec.rb +4 -4
  363. data/spec/adlint/cc1/type_spec.rb +2 -2
  364. data/spec/adlint/location_spec.rb +2 -2
  365. data/spec/conf.d/default_traits.yml +1 -1
  366. data/spec/conf.d/empty_cinit.h +1 -1
  367. data/spec/conf.d/empty_pinit.h +1 -1
  368. data/spec/spec_helper.rb +2 -2
  369. metadata +29 -28
  370. data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +0 -963
  371. data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +0 -204
@@ -0,0 +1,49 @@
1
+ Feature: E0016
2
+
3
+ E0016 detects that a block comment is not terminated in the translation unit.
4
+
5
+ Scenario: `/*' sequence in a string-literal
6
+ Given a target source named "fixture.c" with:
7
+ """
8
+ #define FOO
9
+
10
+ extern void bar(const char *);
11
+
12
+ void baz(void)
13
+ {
14
+ #ifdef FOO
15
+ bar("1 /*\n");
16
+ #else
17
+ bar("2 /*\n");
18
+ #endif
19
+ }
20
+ """
21
+ When I successfully run `adlint fixture.c` on noarch
22
+ Then the output should exactly match with:
23
+ | mesg | line | column |
24
+ | W0118 | 3 | 13 |
25
+ | W0117 | 5 | 6 |
26
+ | W0947 | 8 | 9 |
27
+ | W0628 | 5 | 6 |
28
+
29
+ Scenario: `/*' sequence in a string-literal
30
+ Given a target source named "fixture.c" with:
31
+ """
32
+ extern void bar(const char *);
33
+
34
+ void baz(void)
35
+ {
36
+ #ifdef FOO
37
+ bar("1 /*\n");
38
+ #else
39
+ bar("2 /*\n");
40
+ #endif
41
+ }
42
+ """
43
+ When I successfully run `adlint fixture.c` on noarch
44
+ Then the output should exactly match with:
45
+ | mesg | line | column |
46
+ | W0118 | 1 | 13 |
47
+ | W0117 | 3 | 6 |
48
+ | W0947 | 8 | 9 |
49
+ | W0628 | 3 | 6 |
@@ -0,0 +1,99 @@
1
+ Feature: E0018
2
+
3
+ E0018 detects that an extra semicolon appears in the global scope.
4
+
5
+ Scenario: extra semicolon after variable declaration
6
+ Given a target source named "fixture.c" with:
7
+ """
8
+ int i;;
9
+ """
10
+ When I successfully run `adlint fixture.c` on noarch
11
+ Then the output should exactly match with:
12
+ | mesg | line | column |
13
+ | E0018 | 1 | 7 |
14
+ | W0117 | 1 | 5 |
15
+
16
+ Scenario: extra semicolon after variable definition
17
+ Given a target source named "fixture.c" with:
18
+ """
19
+ int i = 1;;
20
+ """
21
+ When I successfully run `adlint fixture.c` on noarch
22
+ Then the output should exactly match with:
23
+ | mesg | line | column |
24
+ | E0018 | 1 | 11 |
25
+ | W0117 | 1 | 5 |
26
+
27
+ Scenario: extra semicolon before variable declaration
28
+ Given a target source named "fixture.c" with:
29
+ """
30
+ ;int i;
31
+ """
32
+ When I successfully run `adlint fixture.c` on noarch
33
+ Then the output should exactly match with:
34
+ | mesg | line | column |
35
+ | E0018 | 1 | 1 |
36
+ | W0117 | 1 | 6 |
37
+
38
+ Scenario: extra semicolon before variable definition
39
+ Given a target source named "fixture.c" with:
40
+ """
41
+ ;int i = 1;
42
+ """
43
+ When I successfully run `adlint fixture.c` on noarch
44
+ Then the output should exactly match with:
45
+ | mesg | line | column |
46
+ | E0018 | 1 | 1 |
47
+ | W0117 | 1 | 6 |
48
+
49
+ Scenario: extra semicolon after function declaration
50
+ Given a target source named "fixture.c" with:
51
+ """
52
+ extern void foo(void);;
53
+ """
54
+ When I successfully run `adlint fixture.c` on noarch
55
+ Then the output should exactly match with:
56
+ | mesg | line | column |
57
+ | E0018 | 1 | 23 |
58
+ | W0118 | 1 | 13 |
59
+
60
+ Scenario: extra semicolon after function definition
61
+ Given a target source named "fixture.c" with:
62
+ """
63
+ int foo(void)
64
+ {
65
+ return 0;
66
+ };
67
+ """
68
+ When I successfully run `adlint fixture.c` on noarch
69
+ Then the output should exactly match with:
70
+ | mesg | line | column |
71
+ | E0018 | 4 | 2 |
72
+ | W0117 | 1 | 5 |
73
+ | W0628 | 1 | 5 |
74
+
75
+ Scenario: extra semicolon before function declaration
76
+ Given a target source named "fixture.c" with:
77
+ """
78
+ ;extern void foo(void);
79
+ """
80
+ When I successfully run `adlint fixture.c` on noarch
81
+ Then the output should exactly match with:
82
+ | mesg | line | column |
83
+ | E0018 | 1 | 1 |
84
+ | W0118 | 1 | 14 |
85
+
86
+ Scenario: extra semicolon before function definition
87
+ Given a target source named "fixture.c" with:
88
+ """
89
+ ;int foo(void)
90
+ {
91
+ return 0;
92
+ }
93
+ """
94
+ When I successfully run `adlint fixture.c` on noarch
95
+ Then the output should exactly match with:
96
+ | mesg | line | column |
97
+ | E0018 | 1 | 1 |
98
+ | W0117 | 1 | 6 |
99
+ | W0628 | 1 | 6 |
@@ -275,13 +275,13 @@ Feature: W0460
275
275
  int x;
276
276
  int y;
277
277
  };
278
-
278
+
279
279
  struct bar a[3];
280
-
280
+
281
281
  int foo(int i, int j)
282
282
  {
283
283
  int k;
284
-
284
+
285
285
  if (i < 0) {
286
286
  struct bar b;
287
287
  if (j == 0) {
@@ -292,7 +292,7 @@ Feature: W0460
292
292
  else if (i > 10) {
293
293
  k = j ? a[0].x : a[1].y;
294
294
  }
295
-
295
+
296
296
  return k; /* W0460 */
297
297
  }
298
298
  """
@@ -328,13 +328,13 @@ Feature: W0460
328
328
  int x;
329
329
  int y;
330
330
  };
331
-
331
+
332
332
  struct bar a[3];
333
-
333
+
334
334
  int foo(int i, int j)
335
335
  {
336
336
  int k;
337
-
337
+
338
338
  if (i < 0) {
339
339
  struct bar b;
340
340
  if (j == 0) {
@@ -345,7 +345,7 @@ Feature: W0460
345
345
  else {
346
346
  k = j ? a[0].x : a[1].y;
347
347
  }
348
-
348
+
349
349
  return k; /* OK */
350
350
  }
351
351
  """
data/lib/adlint.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # AdLint package loader.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # Analyzer classes.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
data/lib/adlint/annot.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Source code annotations.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
data/lib/adlint/cc1.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # AdLint::Cc1 package loader.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C runtime branch of execution path.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # Builtin functions actually called by the interpreter.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C constant-expression evaluator.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C conversion semantics.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # Controlling expression of selection-statements and iteration-statements.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # Domain of values bound to variables.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C Enumerators.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C runtime environment.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -1,7 +1,7 @@
1
1
  # C expression evaluator.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -47,7 +47,7 @@ module Cc1 #:nodoc:
47
47
 
48
48
  def visit_error_expression(node)
49
49
  checkpoint(node.location)
50
- create_tmpvar
50
+ create_tmpvar.tap { |rslt_var| notify_error_expr_evaled(node, rslt_var) }
51
51
  end
52
52
 
53
53
  def visit_object_specifier(node)
@@ -60,10 +60,13 @@ module Cc1 #:nodoc:
60
60
 
61
61
  if const_var = eval_constant(node)
62
62
  notify_constant_referred(node, const_var)
63
- const_var
63
+ rslt_var = const_var
64
64
  else
65
- create_tmpvar
65
+ rslt_var = create_tmpvar
66
66
  end
67
+
68
+ notify_constant_specifier_evaled(node, rslt_var)
69
+ rslt_var
67
70
  end
68
71
 
69
72
  def visit_string_literal_specifier(node)
@@ -71,21 +74,24 @@ module Cc1 #:nodoc:
71
74
 
72
75
  case node.literal.value
73
76
  when /\A"(.*)"\z/
74
- create_tmpvar(array_type(char_t, $1.length + 1),
75
- create_array_value_of_string($1))
77
+ rslt_var = create_tmpvar(array_type(char_t, $1.length + 1),
78
+ create_array_value_of_string($1))
76
79
  when /\AL"(.*)"\z/i
77
- create_tmpvar(array_type(wchar_t, $1.length + 1),
78
- create_array_value_of_string($1))
80
+ rslt_var = create_tmpvar(array_type(wchar_t, $1.length + 1),
81
+ create_array_value_of_string($1))
79
82
  else
80
- create_tmpvar(array_type(char_t))
83
+ rslt_var = create_tmpvar(array_type(char_t))
81
84
  end
85
+
86
+ notify_string_literal_specifier_evaled(node, rslt_var)
87
+ rslt_var
82
88
  end
83
89
 
84
90
  def visit_null_constant_specifier(node)
85
91
  checkpoint(node.location)
86
- # TODO: NULL may not be 0 on some environments.
87
- # Representation of NULL should be configurable?
88
- create_tmpvar(pointer_type(void_t), scalar_value_of(0))
92
+ rslt_var = create_tmpvar(pointer_type(void_t), scalar_value_of_null)
93
+ notify_null_constant_specifier_evaled(node, rslt_var)
94
+ rslt_var
89
95
  end
90
96
 
91
97
  def visit_grouped_expression(node)
@@ -117,14 +123,12 @@ module Cc1 #:nodoc:
117
123
 
118
124
  def visit_bit_access_by_value_expression(node)
119
125
  checkpoint(node.location)
120
- # TODO: Should support the GCC extension.
121
- create_tmpvar
126
+ eval_bit_access_by_value_expr(node, node.expression.accept(self))
122
127
  end
123
128
 
124
129
  def visit_bit_access_by_pointer_expression(node)
125
130
  checkpoint(node.location)
126
- # TODO: Should support the GCC extension.
127
- create_tmpvar
131
+ eval_bit_access_by_pointer_expr(node, node.expression.accept(self))
128
132
  end
129
133
 
130
134
  def visit_postfix_increment_expression(node)
@@ -139,8 +143,7 @@ module Cc1 #:nodoc:
139
143
 
140
144
  def visit_compound_literal_expression(node)
141
145
  checkpoint(node.location)
142
- # TODO: Should support C99 features.
143
- create_tmpvar(node.type_name.type)
146
+ eval_compound_literal_expr(node)
144
147
  end
145
148
 
146
149
  def visit_prefix_increment_expression(node)
@@ -172,14 +175,14 @@ module Cc1 #:nodoc:
172
175
  checkpoint(node.location)
173
176
 
174
177
  ope_obj = rslt_var = nil
175
- eval_without_side_effect do
178
+ eval_quietly_without_side_effects do
176
179
  rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
177
180
  ope_obj = node.operand.accept(self)
178
181
  if ope_obj.variable?
179
182
  size = ope_obj.type.aligned_byte_size
180
183
  rslt_var = create_tmpvar(rslt_type, scalar_value_of(size))
181
184
  else
182
- return create_tmpvar(rslt_type)
185
+ rslt_var = create_tmpvar(rslt_type)
183
186
  end
184
187
  end
185
188
 
@@ -192,7 +195,7 @@ module Cc1 #:nodoc:
192
195
  resolve_unresolved_type(node.operand)
193
196
 
194
197
  rslt_var = nil
195
- eval_without_side_effect do
198
+ eval_quietly_without_side_effects do
196
199
  rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
197
200
  size = node.operand.type.aligned_byte_size
198
201
  rslt_var = create_tmpvar(rslt_type, scalar_value_of(size))
@@ -205,27 +208,35 @@ module Cc1 #:nodoc:
205
208
  def visit_alignof_expression(node)
206
209
  checkpoint(node.location)
207
210
 
208
- eval_without_side_effect do
211
+ ope_obj = rslt_var = nil
212
+ eval_quietly_without_side_effects do
209
213
  rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
210
214
  ope_obj = node.operand.accept(self)
211
215
  if ope_obj.variable?
212
216
  align = ope_obj.type.byte_alignment
213
- create_tmpvar(rslt_type, scalar_value_of(align))
217
+ rslt_var = create_tmpvar(rslt_type, scalar_value_of(align))
214
218
  else
215
- create_tmpvar(rslt_type)
219
+ rslt_var = create_tmpvar(rslt_type)
216
220
  end
217
221
  end
222
+
223
+ notify_alignof_expr_evaled(node, ope_obj, rslt_var)
224
+ rslt_var
218
225
  end
219
226
 
220
227
  def visit_alignof_type_expression(node)
221
228
  checkpoint(node.location)
222
229
  resolve_unresolved_type(node.operand)
223
230
 
224
- eval_without_side_effect do
231
+ rslt_var = nil
232
+ eval_quietly_without_side_effects do
225
233
  rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
226
234
  align = node.operand.type.aligned_byte_size
227
- create_tmpvar(rslt_type, scalar_value_of(align))
235
+ rslt_var = create_tmpvar(rslt_type, scalar_value_of(align))
228
236
  end
237
+
238
+ notify_alignof_type_expr_evaled(node, node.operand.type, rslt_var)
239
+ rslt_var
229
240
  end
230
241
 
231
242
  def visit_cast_expression(node)
@@ -403,21 +414,24 @@ module Cc1 #:nodoc:
403
414
  end
404
415
 
405
416
  private
406
- def eval_without_side_effect(&block)
407
- originally_quiet = interpreter.quiet_without_side_effect?
408
- unless originally_quiet
409
- interpreter._quiet_without_side_effect = true
417
+ def eval_quietly_without_side_effects(&block)
418
+ unless orig_quiet = interpreter.quiet?
419
+ interpreter._quiet = true
420
+ end
421
+ unless orig_without_side_effects = interpreter.without_side_effects?
422
+ interpreter._without_side_effects = true
410
423
  end
411
424
  yield
412
425
  ensure
413
- unless originally_quiet
414
- interpreter._quiet_without_side_effect = false
426
+ unless orig_quiet
427
+ interpreter._quiet = false
415
428
  # FIXME: Evaluation of an object-specifier doesn't refer to value
416
429
  # of a variable. Thus, no cross-reference record on a
417
430
  # sizeof-expression because cross-reference extraction
418
431
  # watches variable value reference not variable reference.
419
432
  # collect_object_specifiers(node).each { |os| os.accept(self) }
420
433
  end
434
+ interpreter._without_side_effects = orig_without_side_effects
421
435
  end
422
436
 
423
437
  def create_array_value_of_string(str)
@@ -430,7 +444,8 @@ module Cc1 #:nodoc:
430
444
  # NotifierMediator and Conversion.
431
445
 
432
446
  def eval_object_specifier(node)
433
- if var = variable_named(node.identifier.value)
447
+ case
448
+ when var = variable_named(node.identifier.value)
434
449
  var.declarations_and_definitions.each do |dcl_or_def|
435
450
  dcl_or_def.mark_as_referred_by(node.identifier)
436
451
  end
@@ -438,26 +453,24 @@ module Cc1 #:nodoc:
438
453
  # NOTE: Array object will be converted into its start address by the
439
454
  # outer expression. So, it is correct to return an array
440
455
  # object itself.
441
- return var
442
- end
443
-
444
- if fun = function_named(node.identifier.value)
456
+ rslt_obj = var
457
+ when fun = function_named(node.identifier.value)
445
458
  fun.declarations_and_definitions.each do |dcl_or_def|
446
459
  dcl_or_def.mark_as_referred_by(node.identifier)
447
460
  end
448
461
  _notify_object_referred(node, fun)
449
- return fun
450
- end
451
-
452
- if enum = enumerator_named(node.identifier.value)
462
+ rslt_obj = fun
463
+ when enum = enumerator_named(node.identifier.value)
453
464
  enum.mark_as_referred_by(node.identifier)
454
- return create_tmpvar(enum.type, scalar_value_of(enum.value))
465
+ rslt_obj = create_tmpvar(enum.type, scalar_value_of(enum.value))
466
+ else
467
+ fun = declare_implicit_function(node.identifier.value)
468
+ _notify_implicit_function_declared(node, fun)
469
+ _notify_object_referred(node, fun)
470
+ rslt_obj = fun
455
471
  end
456
-
457
- fun = declare_implicit_function(node.identifier.value)
458
- _notify_implicit_function_declared(node, fun)
459
- _notify_object_referred(node, fun)
460
- fun
472
+ notify_object_specifier_evaled(node, rslt_obj)
473
+ rslt_obj
461
474
  end
462
475
 
463
476
  def eval_array_subscript_expr(node, obj, subs)
@@ -619,6 +632,46 @@ module Cc1 #:nodoc:
619
632
  end
620
633
  end
621
634
 
635
+ def eval_bit_access_by_value_expr(node, obj)
636
+ if obj.variable? && obj.type.composite?
637
+ outer_var = obj
638
+ else
639
+ return create_tmpvar
640
+ end
641
+
642
+ # TODO: Should support the GCC extension.
643
+ create_tmpvar.tap do |rslt_var|
644
+ notify_bit_access_expr_evaled(node, outer_var, rslt_var)
645
+ end
646
+ end
647
+
648
+ def eval_bit_access_by_pointer_expr(node, obj)
649
+ obj_type = obj.type.unqualify
650
+ if obj.variable? && obj_type.pointer? && obj_type.base_type.composite?
651
+ ptr = obj
652
+ else
653
+ return create_tmpvar
654
+ end
655
+
656
+ if pointee = pointee_of(ptr)
657
+ if pointee.type.array?
658
+ if first_elem = pointee.inner_variable_at(0)
659
+ pointee = first_elem
660
+ else
661
+ pointee = create_tmpvar(obj_type.base_type)
662
+ end
663
+ end
664
+ end
665
+ # NOTE: A bit-access-by-pointer-expression do refers the value of the
666
+ # pointer object.
667
+ _notify_variable_value_referred(node, ptr)
668
+
669
+ # TODO: Should support the GCC extension.
670
+ create_tmpvar.tap do |rslt_var|
671
+ notify_bit_access_expr_evaled(node, ptr, rslt_var)
672
+ end
673
+ end
674
+
622
675
  def eval_postfix_increment_expr(node, obj)
623
676
  var = object_to_variable(obj, node)
624
677
  if !var.type.scalar? && !var.type.void?
@@ -711,6 +764,13 @@ module Cc1 #:nodoc:
711
764
  create_tmpvar(var.type, var.value)
712
765
  end
713
766
 
767
+ def eval_compound_literal_expr(node)
768
+ # TODO: Should support C99 features.
769
+ create_tmpvar(node.type_name.type).tap do |rslt_var|
770
+ notify_compound_literal_expr_evaled(node, rslt_var)
771
+ end
772
+ end
773
+
714
774
  def eval_address_expr(node, obj)
715
775
  # NOTE: An address-expression does not read the value of the object.
716
776
  # But value reference should be notified to emphasize global
@@ -799,6 +859,8 @@ module Cc1 #:nodoc:
799
859
  # is discarded when the return value is casted before assigning
800
860
  # to a variable.
801
861
  _notify_variable_value_referred(node, var)
862
+
863
+ notify_cast_expr_evaled(node, var, rslt_var)
802
864
  rslt_var
803
865
  end
804
866