adlint 2.4.6 → 2.4.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 (306) hide show
  1. data/ChangeLog +163 -0
  2. data/MANIFEST +12 -0
  3. data/NEWS +20 -4
  4. data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +2 -2
  5. data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
  6. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
  7. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  8. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  9. data/features/code_check/E0013.feature +0 -2
  10. data/features/code_check/W0001.feature +0 -2
  11. data/features/code_check/W0002.feature +0 -2
  12. data/features/code_check/W0003.feature +0 -2
  13. data/features/code_check/W0007.feature +0 -2
  14. data/features/code_check/W0010.feature +1 -3
  15. data/features/code_check/W0013.feature +0 -2
  16. data/features/code_check/W0016.feature +0 -2
  17. data/features/code_check/W0017.feature +0 -2
  18. data/features/code_check/W0025.feature +0 -2
  19. data/features/code_check/W0026.feature +0 -2
  20. data/features/code_check/W0070.feature +0 -2
  21. data/features/code_check/W0071.feature +0 -2
  22. data/features/code_check/W0093.feature +0 -2
  23. data/features/code_check/W0104.feature +0 -2
  24. data/features/code_check/W0109.feature +0 -2
  25. data/features/code_check/W0119.feature +0 -2
  26. data/features/code_check/W0120.feature +0 -2
  27. data/features/code_check/W0121.feature +0 -2
  28. data/features/code_check/W0122.feature +0 -2
  29. data/features/code_check/W0123.feature +0 -2
  30. data/features/code_check/W0124.feature +0 -2
  31. data/features/code_check/W0125.feature +0 -2
  32. data/features/code_check/W0126.feature +0 -2
  33. data/features/code_check/W0127.feature +0 -2
  34. data/features/code_check/W0128.feature +0 -2
  35. data/features/code_check/W0129.feature +0 -2
  36. data/features/code_check/W0130.feature +0 -2
  37. data/features/code_check/W0131.feature +0 -2
  38. data/features/code_check/W0132.feature +0 -2
  39. data/features/code_check/W0133.feature +0 -2
  40. data/features/code_check/W0134.feature +0 -2
  41. data/features/code_check/W0135.feature +0 -2
  42. data/features/code_check/W0136.feature +0 -2
  43. data/features/code_check/W0137.feature +0 -2
  44. data/features/code_check/W0138.feature +0 -2
  45. data/features/code_check/W0139.feature +0 -2
  46. data/features/code_check/W0140.feature +0 -2
  47. data/features/code_check/W0141.feature +0 -2
  48. data/features/code_check/W0142.feature +0 -2
  49. data/features/code_check/W0143.feature +0 -2
  50. data/features/code_check/W0144.feature +0 -2
  51. data/features/code_check/W0145.feature +0 -2
  52. data/features/code_check/W0146.feature +0 -2
  53. data/features/code_check/W0147.feature +0 -2
  54. data/features/code_check/W0148.feature +0 -2
  55. data/features/code_check/W0149.feature +0 -2
  56. data/features/code_check/W0150.feature +0 -2
  57. data/features/code_check/W0151.feature +0 -2
  58. data/features/code_check/W0152.feature +0 -2
  59. data/features/code_check/W0153.feature +0 -2
  60. data/features/code_check/W0154.feature +0 -2
  61. data/features/code_check/W0155.feature +0 -2
  62. data/features/code_check/W0156.feature +0 -2
  63. data/features/code_check/W0157.feature +0 -2
  64. data/features/code_check/W0158.feature +0 -2
  65. data/features/code_check/W0159.feature +0 -2
  66. data/features/code_check/W0160.feature +0 -2
  67. data/features/code_check/W0161.feature +0 -2
  68. data/features/code_check/W0162.feature +0 -2
  69. data/features/code_check/W0163.feature +0 -2
  70. data/features/code_check/W0164.feature +0 -2
  71. data/features/code_check/W0165.feature +0 -2
  72. data/features/code_check/W0166.feature +0 -2
  73. data/features/code_check/W0167.feature +0 -2
  74. data/features/code_check/W0168.feature +0 -2
  75. data/features/code_check/W0169.feature +0 -2
  76. data/features/code_check/W0170.feature +0 -2
  77. data/features/code_check/W0171.feature +0 -2
  78. data/features/code_check/W0172.feature +0 -2
  79. data/features/code_check/W0173.feature +0 -2
  80. data/features/code_check/W0174.feature +0 -2
  81. data/features/code_check/W0175.feature +0 -2
  82. data/features/code_check/W0176.feature +0 -2
  83. data/features/code_check/W0177.feature +0 -2
  84. data/features/code_check/W0178.feature +0 -2
  85. data/features/code_check/W0179.feature +0 -2
  86. data/features/code_check/W0180.feature +0 -2
  87. data/features/code_check/W0181.feature +0 -2
  88. data/features/code_check/W0182.feature +0 -2
  89. data/features/code_check/W0183.feature +0 -2
  90. data/features/code_check/W0184.feature +0 -2
  91. data/features/code_check/W0185.feature +0 -2
  92. data/features/code_check/W0186.feature +0 -2
  93. data/features/code_check/W0187.feature +0 -2
  94. data/features/code_check/W0188.feature +0 -2
  95. data/features/code_check/W0189.feature +0 -2
  96. data/features/code_check/W0190.feature +0 -2
  97. data/features/code_check/W0191.feature +0 -2
  98. data/features/code_check/W0192.feature +0 -2
  99. data/features/code_check/W0193.feature +0 -2
  100. data/features/code_check/W0194.feature +0 -2
  101. data/features/code_check/W0195.feature +0 -2
  102. data/features/code_check/W0196.feature +0 -2
  103. data/features/code_check/W0197.feature +0 -2
  104. data/features/code_check/W0198.feature +0 -2
  105. data/features/code_check/W0199.feature +0 -2
  106. data/features/code_check/W0200.feature +0 -2
  107. data/features/code_check/W0201.feature +0 -2
  108. data/features/code_check/W0202.feature +0 -2
  109. data/features/code_check/W0203.feature +0 -2
  110. data/features/code_check/W0204.feature +0 -2
  111. data/features/code_check/W0205.feature +0 -2
  112. data/features/code_check/W0206.feature +0 -2
  113. data/features/code_check/W0207.feature +0 -2
  114. data/features/code_check/W0208.feature +0 -2
  115. data/features/code_check/W0209.feature +0 -2
  116. data/features/code_check/W0210.feature +0 -2
  117. data/features/code_check/W0211.feature +0 -2
  118. data/features/code_check/W0212.feature +0 -2
  119. data/features/code_check/W0213.feature +0 -2
  120. data/features/code_check/W0214.feature +0 -2
  121. data/features/code_check/W0215.feature +0 -2
  122. data/features/code_check/W0216.feature +0 -2
  123. data/features/code_check/W0217.feature +0 -2
  124. data/features/code_check/W0218.feature +0 -2
  125. data/features/code_check/W0219.feature +0 -2
  126. data/features/code_check/W0220.feature +0 -2
  127. data/features/code_check/W0221.feature +0 -2
  128. data/features/code_check/W0222.feature +0 -2
  129. data/features/code_check/W0223.feature +0 -2
  130. data/features/code_check/W0224.feature +0 -2
  131. data/features/code_check/W0225.feature +0 -2
  132. data/features/code_check/W0226.feature +0 -2
  133. data/features/code_check/W0227.feature +0 -2
  134. data/features/code_check/W0228.feature +0 -2
  135. data/features/code_check/W0229.feature +0 -2
  136. data/features/code_check/W0230.feature +0 -2
  137. data/features/code_check/W0231.feature +0 -2
  138. data/features/code_check/W0232.feature +0 -2
  139. data/features/code_check/W0233.feature +0 -2
  140. data/features/code_check/W0234.feature +0 -2
  141. data/features/code_check/W0235.feature +0 -2
  142. data/features/code_check/W0236.feature +0 -2
  143. data/features/code_check/W0237.feature +0 -2
  144. data/features/code_check/W0238.feature +0 -2
  145. data/features/code_check/W0239.feature +0 -2
  146. data/features/code_check/W0240.feature +0 -2
  147. data/features/code_check/W0241.feature +0 -2
  148. data/features/code_check/W0242.feature +0 -2
  149. data/features/code_check/W0243.feature +0 -2
  150. data/features/code_check/W0244.feature +0 -2
  151. data/features/code_check/W0245.feature +0 -2
  152. data/features/code_check/W0246.feature +0 -2
  153. data/features/code_check/W0247.feature +0 -2
  154. data/features/code_check/W0248.feature +0 -2
  155. data/features/code_check/W0249.feature +0 -2
  156. data/features/code_check/W0250.feature +0 -2
  157. data/features/code_check/W0251.feature +0 -2
  158. data/features/code_check/W0252.feature +0 -2
  159. data/features/code_check/W0253.feature +0 -2
  160. data/features/code_check/W0254.feature +0 -2
  161. data/features/code_check/W0425.feature +0 -2
  162. data/features/code_check/W0431.feature +0 -2
  163. data/features/code_check/W0432.feature +0 -2
  164. data/features/code_check/W0477.feature +0 -2
  165. data/features/code_check/W0478.feature +0 -2
  166. data/features/code_check/W0479.feature +0 -2
  167. data/features/code_check/W0480.feature +0 -2
  168. data/features/code_check/W0481.feature +0 -2
  169. data/features/code_check/W0482.feature +0 -2
  170. data/features/code_check/W0483.feature +0 -2
  171. data/features/code_check/W0488.feature +132 -0
  172. data/features/code_check/W0489.feature +78 -0
  173. data/features/code_check/W0490.feature +83 -0
  174. data/features/code_check/W0495.feature +60 -0
  175. data/features/code_check/W0496.feature +63 -0
  176. data/features/code_check/W0497.feature +65 -0
  177. data/features/code_check/W0498.feature +120 -0
  178. data/features/code_check/W0499.feature +63 -0
  179. data/features/code_check/W0500.feature +66 -0
  180. data/features/code_check/W0501.feature +69 -0
  181. data/features/code_check/W0502.feature +64 -0
  182. data/features/code_check/W0573.feature +0 -2
  183. data/features/code_check/W0583.feature +0 -2
  184. data/features/code_check/W0606.feature +0 -2
  185. data/features/code_check/W0635.feature +0 -2
  186. data/features/code_check/W0641.feature +0 -2
  187. data/features/code_check/W0643.feature +0 -2
  188. data/features/code_check/W0644.feature +0 -2
  189. data/features/code_check/W0645.feature +0 -2
  190. data/features/code_check/W0646.feature +0 -2
  191. data/features/code_check/W0649.feature +0 -2
  192. data/features/code_check/W0650.feature +0 -2
  193. data/features/code_check/W0655.feature +43 -0
  194. data/features/code_check/W0685.feature +0 -2
  195. data/features/code_check/W0686.feature +0 -2
  196. data/features/code_check/W0687.feature +0 -2
  197. data/features/code_check/W0688.feature +0 -2
  198. data/features/code_check/W0689.feature +0 -2
  199. data/features/code_check/W0690.feature +0 -2
  200. data/features/code_check/W0691.feature +0 -2
  201. data/features/code_check/W0692.feature +0 -2
  202. data/features/code_check/W0694.feature +0 -2
  203. data/features/code_check/W0695.feature +0 -2
  204. data/features/code_check/W0697.feature +0 -2
  205. data/features/code_check/W0698.feature +0 -2
  206. data/features/code_check/W0699.feature +0 -2
  207. data/features/code_check/W0700.feature +0 -2
  208. data/features/code_check/W0703.feature +0 -2
  209. data/features/code_check/W0705.feature +6 -2
  210. data/features/code_check/W0707.feature +4 -2
  211. data/features/code_check/W0711.feature +0 -2
  212. data/features/code_check/W0712.feature +0 -2
  213. data/features/code_check/W0713.feature +0 -2
  214. data/features/code_check/W0714.feature +0 -2
  215. data/features/code_check/W0715.feature +0 -2
  216. data/features/code_check/W0716.feature +0 -2
  217. data/features/code_check/W0717.feature +0 -2
  218. data/features/code_check/W0718.feature +0 -2
  219. data/features/code_check/W0719.feature +0 -2
  220. data/features/code_check/W0723.feature +0 -2
  221. data/features/code_check/W0726.feature +0 -2
  222. data/features/code_check/W0732.feature +0 -2
  223. data/features/code_check/W0733.feature +0 -2
  224. data/features/code_check/W0734.feature +0 -2
  225. data/features/code_check/W0735.feature +0 -2
  226. data/features/code_check/W0745.feature +1 -2
  227. data/features/code_check/W0747.feature +0 -2
  228. data/features/code_check/W0748.feature +0 -2
  229. data/features/code_check/W0749.feature +0 -2
  230. data/features/code_check/W0750.feature +0 -2
  231. data/features/code_check/W0751.feature +0 -2
  232. data/features/code_check/W0752.feature +0 -2
  233. data/features/code_check/W0753.feature +0 -2
  234. data/features/code_check/W0754.feature +0 -2
  235. data/features/code_check/W0755.feature +0 -2
  236. data/features/code_check/W0756.feature +0 -2
  237. data/features/code_check/W0757.feature +0 -2
  238. data/features/code_check/W0758.feature +0 -2
  239. data/features/code_check/W0759.feature +0 -2
  240. data/features/code_check/W0760.feature +0 -2
  241. data/features/code_check/W0761.feature +0 -2
  242. data/features/code_check/W0762.feature +0 -2
  243. data/features/code_check/W0763.feature +0 -2
  244. data/features/code_check/W0764.feature +0 -2
  245. data/features/code_check/W0765.feature +0 -2
  246. data/features/code_check/W0766.feature +0 -2
  247. data/features/code_check/W0767.feature +0 -2
  248. data/features/code_check/W0768.feature +0 -2
  249. data/features/code_check/W0769.feature +0 -2
  250. data/features/code_check/W0780.feature +0 -2
  251. data/features/code_check/W0781.feature +0 -2
  252. data/features/code_check/W0783.feature +0 -2
  253. data/features/code_check/W0787.feature +0 -2
  254. data/features/code_check/W0792.feature +0 -2
  255. data/features/code_check/W0793.feature +0 -2
  256. data/features/code_check/W0794.feature +0 -2
  257. data/features/code_check/W0801.feature +0 -2
  258. data/features/code_check/W0805.feature +0 -2
  259. data/features/code_check/W0806.feature +0 -2
  260. data/features/code_check/W0807.feature +0 -2
  261. data/features/code_check/W0808.feature +0 -2
  262. data/features/code_check/W0809.feature +0 -2
  263. data/features/code_check/W0811.feature +0 -2
  264. data/features/code_check/W0830.feature +0 -2
  265. data/features/code_check/W0833.feature +0 -2
  266. data/features/code_check/W0834.feature +1 -3
  267. data/features/code_check/W1026.feature +0 -2
  268. data/features/code_check/W1030.feature +0 -2
  269. data/features/code_check/W1031.feature +0 -2
  270. data/features/code_check/W1039.feature +0 -2
  271. data/features/code_check/W1040.feature +0 -2
  272. data/features/code_check/W1041.feature +0 -2
  273. data/features/code_check/W1046.feature +0 -2
  274. data/features/code_check/W1047.feature +0 -2
  275. data/features/code_check/W1052.feature +0 -2
  276. data/features/code_check/W1066.feature +0 -2
  277. data/features/code_check/W1067.feature +0 -2
  278. data/features/code_check/W1068.feature +0 -2
  279. data/features/code_check/W1069.feature +0 -2
  280. data/features/code_check/W1070.feature +0 -2
  281. data/features/code_check/W1071.feature +0 -2
  282. data/features/code_check/W1072.feature +0 -2
  283. data/features/code_check/W1073.feature +1 -3
  284. data/features/code_check/W1074.feature +3 -4
  285. data/features/code_check/W1075.feature +0 -2
  286. data/features/code_check/W1076.feature +0 -2
  287. data/features/code_check/W1077.feature +0 -2
  288. data/features/code_check/W9001.feature +0 -2
  289. data/features/code_check/W9003.feature +3 -3
  290. data/lib/adlint/c/branch.rb +2 -2
  291. data/lib/adlint/c/environ.rb +3 -3
  292. data/lib/adlint/c/expr.rb +67 -39
  293. data/lib/adlint/c/interp.rb +10 -1
  294. data/lib/adlint/c/object.rb +6 -4
  295. data/lib/adlint/c/parser.rb +1 -1
  296. data/lib/adlint/c/value.rb +27 -10
  297. data/lib/adlint/cpp/constexpr.rb +1 -1
  298. data/lib/adlint/exam/c_builtin/c_check.rb +502 -420
  299. data/lib/adlint/version.rb +2 -2
  300. data/share/doc/developers_guide_ja.html +3 -3
  301. data/share/doc/developers_guide_ja.texi +1 -1
  302. data/share/doc/users_guide_en.html +10 -10
  303. data/share/doc/users_guide_en.texi +8 -8
  304. data/share/doc/users_guide_ja.html +10 -10
  305. data/share/doc/users_guide_ja.texi +8 -8
  306. metadata +15 -3
@@ -29,5 +29,3 @@ Feature: W9001
29
29
  When I successfully run `adlint fixture.c` on noarch
30
30
  Then the output should exactly match with:
31
31
  | mesg | line | column |
32
-
33
- # vim:ts=2:sw=2:sts=2:et:
@@ -123,7 +123,6 @@ Feature: W9003
123
123
  | W0629 | 3 | 12 |
124
124
  | W0490 | 5 | 9 |
125
125
  | W0497 | 5 | 9 |
126
- | W0497 | 5 | 9 |
127
126
  | W0502 | 5 | 9 |
128
127
  | W0628 | 3 | 12 |
129
128
 
@@ -141,6 +140,7 @@ Feature: W9003
141
140
  Then the output should exactly match with:
142
141
  | mesg | line | column |
143
142
  | W0117 | 3 | 8 |
143
+ | W0031 | 3 | 16 |
144
144
  | W0104 | 3 | 16 |
145
145
  | W0628 | 3 | 8 |
146
146
 
@@ -161,6 +161,7 @@ Feature: W9003
161
161
  | W0150 | 5 | 12 |
162
162
  | W9003 | 5 | 12 |
163
163
  | W0286 | 5 | 5 |
164
+ | W0031 | 3 | 13 |
164
165
  | W0104 | 3 | 13 |
165
166
  | W0628 | 3 | 5 |
166
167
 
@@ -178,7 +179,6 @@ Feature: W9003
178
179
  Then the output should exactly match with:
179
180
  | mesg | line | column |
180
181
  | W0117 | 3 | 5 |
182
+ | W0031 | 3 | 13 |
181
183
  | W0104 | 3 | 13 |
182
184
  | W0628 | 3 | 5 |
183
-
184
- # vim:ts=2:sw=2:sts=2:et:
@@ -96,9 +96,9 @@ module C #:nodoc:
96
96
  # TODO: Study about introducing inter-value-constraints to correctly
97
97
  # manage value domains of controlling variables related with each
98
98
  # other.
99
- environment.end_versioning(false)
99
+ environment.end_versioning(break_with_return?, true)
100
100
  else
101
- environment.end_versioning(break_with_return?)
101
+ environment.end_versioning(break_with_return?, false)
102
102
  end
103
103
  environment.leave_versioning_group(!@group.complete?) if final?
104
104
 
@@ -121,9 +121,9 @@ module C #:nodoc:
121
121
  @variable_table.begin_variables_value_versioning
122
122
  end
123
123
 
124
- def end_versioning(rollback_this_version)
125
- if rollback_this_version
126
- @variable_table.rollback_latest_variables_value_version!
124
+ def end_versioning(thin_this_version, with_rollback = thin_this_version)
125
+ if thin_this_version
126
+ @variable_table.thin_latest_variables_value_version!(with_rollback)
127
127
  end
128
128
  @variable_table.end_variables_value_versioning
129
129
  end
data/lib/adlint/c/expr.rb CHANGED
@@ -1664,22 +1664,25 @@ module C #:nodoc:
1664
1664
  def visit_sizeof_expression(node)
1665
1665
  checkpoint(node.location)
1666
1666
 
1667
- if size_t_type = type_of(UserTypeId.new("size_t"))
1668
- result_type = size_t_type
1669
- else
1670
- result_type = unsigned_long_type
1671
- end
1667
+ variable = result = nil
1668
+ eval_without_side_effect do
1669
+ if size_t_type = type_of(UserTypeId.new("size_t"))
1670
+ result_type = size_t_type
1671
+ else
1672
+ result_type = unsigned_long_type
1673
+ end
1672
1674
 
1673
- object = node.operand.accept(self)
1674
- if object.variable?
1675
- variable = object
1676
- result = temporary_variable(
1677
- result_type, ScalarValue.of(variable.type.aligned_byte_size))
1678
- notify_sizeof_expr_evaled(node, variable, result)
1679
- else
1680
- result = temporary_variable(result_type)
1675
+ object = node.operand.accept(self)
1676
+ if object.variable?
1677
+ variable = object
1678
+ result = temporary_variable(
1679
+ result_type, ScalarValue.of(variable.type.aligned_byte_size))
1680
+ else
1681
+ return temporary_variable(result_type)
1682
+ end
1681
1683
  end
1682
1684
 
1685
+ notify_sizeof_expr_evaled(node, variable, result)
1683
1686
  result
1684
1687
  end
1685
1688
 
@@ -1688,35 +1691,40 @@ module C #:nodoc:
1688
1691
 
1689
1692
  resolve_unresolved_type(node.operand)
1690
1693
 
1691
- if size_t_type = type_of(UserTypeId.new("size_t"))
1692
- result_type = size_t_type
1693
- else
1694
- result_type = unsigned_long_type
1694
+ result = nil
1695
+ eval_without_side_effect do
1696
+ if size_t_type = type_of(UserTypeId.new("size_t"))
1697
+ result_type = size_t_type
1698
+ else
1699
+ result_type = unsigned_long_type
1700
+ end
1701
+
1702
+ result = temporary_variable(
1703
+ result_type, ScalarValue.of(node.operand.type.aligned_byte_size))
1695
1704
  end
1696
1705
 
1697
- result = temporary_variable(
1698
- result_type, ScalarValue.of(node.operand.type.aligned_byte_size))
1699
1706
  notify_sizeof_type_expr_evaled(node, node.operand.type, result)
1700
-
1701
1707
  result
1702
1708
  end
1703
1709
 
1704
1710
  def visit_alignof_expression(node)
1705
1711
  checkpoint(node.location)
1706
1712
 
1707
- if size_t_type = type_of(UserTypeId.new("size_t"))
1708
- result_type = size_t_type
1709
- else
1710
- result_type = unsigned_long_type
1711
- end
1713
+ eval_without_side_effect do
1714
+ if size_t_type = type_of(UserTypeId.new("size_t"))
1715
+ result_type = size_t_type
1716
+ else
1717
+ result_type = unsigned_long_type
1718
+ end
1712
1719
 
1713
- object = node.operand.accept(self)
1714
- if object.variable?
1715
- variable = object
1716
- temporary_variable(result_type,
1717
- ScalarValue.of(variable.type.byte_alignment))
1718
- else
1719
- temporary_variable(result_type)
1720
+ object = node.operand.accept(self)
1721
+ if object.variable?
1722
+ variable = object
1723
+ temporary_variable(result_type,
1724
+ ScalarValue.of(variable.type.byte_alignment))
1725
+ else
1726
+ temporary_variable(result_type)
1727
+ end
1720
1728
  end
1721
1729
  end
1722
1730
 
@@ -1725,14 +1733,16 @@ module C #:nodoc:
1725
1733
 
1726
1734
  resolve_unresolved_type(node.operand)
1727
1735
 
1728
- if size_t_type = type_of(UserTypeId.new("size_t"))
1729
- result_type = size_t_type
1730
- else
1731
- result_type = unsigned_long_type
1732
- end
1736
+ eval_without_side_effect do
1737
+ if size_t_type = type_of(UserTypeId.new("size_t"))
1738
+ result_type = size_t_type
1739
+ else
1740
+ result_type = unsigned_long_type
1741
+ end
1733
1742
 
1734
- temporary_variable(result_type,
1735
- ScalarValue.of(node.operand.type.aligned_byte_size))
1743
+ temporary_variable(result_type,
1744
+ ScalarValue.of(node.operand.type.aligned_byte_size))
1745
+ end
1736
1746
  end
1737
1747
 
1738
1748
  def visit_cast_expression(node)
@@ -1929,6 +1939,24 @@ module C #:nodoc:
1929
1939
 
1930
1940
  node.expressions.map { |expression| expression.accept(self) }.last
1931
1941
  end
1942
+
1943
+ private
1944
+ def eval_without_side_effect(&block)
1945
+ originally_quiet = interpreter.quiet_without_side_effect?
1946
+ unless originally_quiet
1947
+ interpreter._quiet_without_side_effect = true
1948
+ end
1949
+ yield
1950
+ ensure
1951
+ unless originally_quiet
1952
+ interpreter._quiet_without_side_effect = false
1953
+ # FIXME: Evaluation of an object-specifier doesn't refer to value
1954
+ # of a variable. Thus, no cross-reference record on a
1955
+ # sizeof-expression because cross-reference extraction
1956
+ # watches variable value reference not variable reference.
1957
+ # collect_object_specifiers(node).each { |os| os.accept(self) }
1958
+ end
1959
+ end
1932
1960
  end
1933
1961
 
1934
1962
  end
@@ -484,6 +484,15 @@ module C #:nodoc:
484
484
  current_options.include?(QUIET_WITHOUT_SIDE_EFFECT)
485
485
  end
486
486
 
487
+ def _quiet_without_side_effect=(quiet_without_side_effect)
488
+ # NOTE: This method is called only from ExpressionEvaluator.
489
+ if quiet_without_side_effect
490
+ current_options.add(QUIET_WITHOUT_SIDE_EFFECT)
491
+ else
492
+ current_options.delete(QUIET_WITHOUT_SIDE_EFFECT)
493
+ end
494
+ end
495
+
487
496
  def _active_function
488
497
  # NOTE: This method is called only from
489
498
  # StatementInterpreter#visit_return_statement.
@@ -796,7 +805,7 @@ module C #:nodoc:
796
805
  # than one named member may have incomplete array type; such a
797
806
  # structure (and any union containing, possibly recursively, a
798
807
  # member that is such a structure) shall not be a member of a
799
- # structure or an element of an array.
808
+ # structure or an element of an array.
800
809
  #
801
810
  # NOTE: Size of the last incomplete array member should not be
802
811
  # deducted in initialization. It is treated as a pointer.
@@ -246,8 +246,8 @@ module C #:nodoc:
246
246
  value.end_versioning
247
247
  end
248
248
 
249
- def rollback_latest_value_version!
250
- value.rollback_latest_version!
249
+ def thin_latest_value_version!(with_rollback)
250
+ value.thin_latest_version!(with_rollback)
251
251
  end
252
252
 
253
253
  def rollback_all_value_versions!
@@ -678,9 +678,11 @@ module C #:nodoc:
678
678
  end
679
679
  end
680
680
 
681
- def rollback_latest_variables_value_version!
681
+ def thin_latest_variables_value_version!(with_rollback)
682
682
  @named_variables.each do |hash|
683
- hash.each_value { |variable| variable.rollback_latest_value_version! }
683
+ hash.each_value do |variable|
684
+ variable.thin_latest_value_version!(with_rollback)
685
+ end
684
686
  end
685
687
  end
686
688
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.8
3
+ # This file is automatically generated by Racc 1.4.9
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -2093,15 +2093,17 @@ module C #:nodoc:
2093
2093
  invalidate_memo!
2094
2094
  end
2095
2095
 
2096
- def rollback_latest_version!
2097
- if @version_controller.rollback
2096
+ def thin_latest_version!(with_rollback)
2097
+ if @version_controller.thin_current_version(with_rollback)
2098
2098
  invalidate_memo!
2099
2099
  end
2100
2100
  end
2101
2101
 
2102
2102
  def rollback_all_versions!
2103
2103
  delete_descendants!
2104
- _orig_overwrite!(@version_controller.original_value)
2104
+ original_value = @version_controller.original_value
2105
+ @version_controller = nil
2106
+ _orig_overwrite!(original_value)
2105
2107
  @version_controller = ValueVersionController.new(self)
2106
2108
  invalidate_memo!
2107
2109
  end
@@ -2138,7 +2140,7 @@ module C #:nodoc:
2138
2140
  end
2139
2141
 
2140
2142
  def effective_values
2141
- @version_controller.current_values
2143
+ @version_controller ? @version_controller.current_values : [self]
2142
2144
  end
2143
2145
 
2144
2146
  extend Memoizable
@@ -2191,17 +2193,27 @@ module C #:nodoc:
2191
2193
  fork_all_versions
2192
2194
  end
2193
2195
 
2194
- def rollback
2196
+ def thin_current_version(with_rollback)
2197
+ # NOTE: This method must be called in the forking section.
2195
2198
  return false unless current_version.forked?
2196
2199
 
2197
- # NOTE: This method must be called in the forking section.
2198
- current_versioning_group.delete_current_version
2199
- current_versioning_group.base_values.each do |multi_value|
2200
- multi_value.rollback!
2200
+ if with_rollback
2201
+ initial_values = current_version.initial_values
2202
+ current_versioning_group.delete_current_version
2203
+ base_values = current_versioning_group.base_values
2204
+ base_values.zip(initial_values).each do |multi_value, init_value|
2205
+ multi_value.rollback!
2206
+ multi_value.overwrite!(init_value) if init_value
2207
+ end
2208
+ else
2209
+ current_versioning_group.delete_current_version
2210
+ current_versioning_group.base_values.each do |multi_value|
2211
+ multi_value.rollback!
2212
+ end
2201
2213
  end
2214
+
2202
2215
  begin_forking
2203
2216
  mark_current_versioning_group_as_sticky
2204
-
2205
2217
  true
2206
2218
  end
2207
2219
 
@@ -2355,10 +2367,12 @@ module C #:nodoc:
2355
2367
  class Version
2356
2368
  def initialize(values, original = false)
2357
2369
  @values = values
2370
+ @initial_values = []
2358
2371
  @state = original ? :original : :forking
2359
2372
  end
2360
2373
 
2361
2374
  attr_accessor :values
2375
+ attr_reader :initial_values
2362
2376
 
2363
2377
  def original?
2364
2378
  @state == :original
@@ -2375,6 +2389,9 @@ module C #:nodoc:
2375
2389
  def fork_from(base_version)
2376
2390
  if forking?
2377
2391
  @values = base_version.values.map { |multi_value| multi_value.fork }
2392
+ @initial_values = @values.each_with_object([]) { |value, ary|
2393
+ ary.push(value.to_single_value.dup)
2394
+ }
2378
2395
  @state = :forked
2379
2396
  end
2380
2397
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.8
3
+ # This file is automatically generated by Racc 1.4.9
4
4
  # from Racc grammer file "".
5
5
  #
6
6