adlint 2.4.6 → 2.4.10
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +163 -0
- data/MANIFEST +12 -0
- data/NEWS +20 -4
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +2 -2
- data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
- data/etc/mesg.d/core/en_US/messages.yml +1 -1
- data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
- data/features/code_check/E0013.feature +0 -2
- data/features/code_check/W0001.feature +0 -2
- data/features/code_check/W0002.feature +0 -2
- data/features/code_check/W0003.feature +0 -2
- data/features/code_check/W0007.feature +0 -2
- data/features/code_check/W0010.feature +1 -3
- data/features/code_check/W0013.feature +0 -2
- data/features/code_check/W0016.feature +0 -2
- data/features/code_check/W0017.feature +0 -2
- data/features/code_check/W0025.feature +0 -2
- data/features/code_check/W0026.feature +0 -2
- data/features/code_check/W0070.feature +0 -2
- data/features/code_check/W0071.feature +0 -2
- data/features/code_check/W0093.feature +0 -2
- data/features/code_check/W0104.feature +0 -2
- data/features/code_check/W0109.feature +0 -2
- data/features/code_check/W0119.feature +0 -2
- data/features/code_check/W0120.feature +0 -2
- data/features/code_check/W0121.feature +0 -2
- data/features/code_check/W0122.feature +0 -2
- data/features/code_check/W0123.feature +0 -2
- data/features/code_check/W0124.feature +0 -2
- data/features/code_check/W0125.feature +0 -2
- data/features/code_check/W0126.feature +0 -2
- data/features/code_check/W0127.feature +0 -2
- data/features/code_check/W0128.feature +0 -2
- data/features/code_check/W0129.feature +0 -2
- data/features/code_check/W0130.feature +0 -2
- data/features/code_check/W0131.feature +0 -2
- data/features/code_check/W0132.feature +0 -2
- data/features/code_check/W0133.feature +0 -2
- data/features/code_check/W0134.feature +0 -2
- data/features/code_check/W0135.feature +0 -2
- data/features/code_check/W0136.feature +0 -2
- data/features/code_check/W0137.feature +0 -2
- data/features/code_check/W0138.feature +0 -2
- data/features/code_check/W0139.feature +0 -2
- data/features/code_check/W0140.feature +0 -2
- data/features/code_check/W0141.feature +0 -2
- data/features/code_check/W0142.feature +0 -2
- data/features/code_check/W0143.feature +0 -2
- data/features/code_check/W0144.feature +0 -2
- data/features/code_check/W0145.feature +0 -2
- data/features/code_check/W0146.feature +0 -2
- data/features/code_check/W0147.feature +0 -2
- data/features/code_check/W0148.feature +0 -2
- data/features/code_check/W0149.feature +0 -2
- data/features/code_check/W0150.feature +0 -2
- data/features/code_check/W0151.feature +0 -2
- data/features/code_check/W0152.feature +0 -2
- data/features/code_check/W0153.feature +0 -2
- data/features/code_check/W0154.feature +0 -2
- data/features/code_check/W0155.feature +0 -2
- data/features/code_check/W0156.feature +0 -2
- data/features/code_check/W0157.feature +0 -2
- data/features/code_check/W0158.feature +0 -2
- data/features/code_check/W0159.feature +0 -2
- data/features/code_check/W0160.feature +0 -2
- data/features/code_check/W0161.feature +0 -2
- data/features/code_check/W0162.feature +0 -2
- data/features/code_check/W0163.feature +0 -2
- data/features/code_check/W0164.feature +0 -2
- data/features/code_check/W0165.feature +0 -2
- data/features/code_check/W0166.feature +0 -2
- data/features/code_check/W0167.feature +0 -2
- data/features/code_check/W0168.feature +0 -2
- data/features/code_check/W0169.feature +0 -2
- data/features/code_check/W0170.feature +0 -2
- data/features/code_check/W0171.feature +0 -2
- data/features/code_check/W0172.feature +0 -2
- data/features/code_check/W0173.feature +0 -2
- data/features/code_check/W0174.feature +0 -2
- data/features/code_check/W0175.feature +0 -2
- data/features/code_check/W0176.feature +0 -2
- data/features/code_check/W0177.feature +0 -2
- data/features/code_check/W0178.feature +0 -2
- data/features/code_check/W0179.feature +0 -2
- data/features/code_check/W0180.feature +0 -2
- data/features/code_check/W0181.feature +0 -2
- data/features/code_check/W0182.feature +0 -2
- data/features/code_check/W0183.feature +0 -2
- data/features/code_check/W0184.feature +0 -2
- data/features/code_check/W0185.feature +0 -2
- data/features/code_check/W0186.feature +0 -2
- data/features/code_check/W0187.feature +0 -2
- data/features/code_check/W0188.feature +0 -2
- data/features/code_check/W0189.feature +0 -2
- data/features/code_check/W0190.feature +0 -2
- data/features/code_check/W0191.feature +0 -2
- data/features/code_check/W0192.feature +0 -2
- data/features/code_check/W0193.feature +0 -2
- data/features/code_check/W0194.feature +0 -2
- data/features/code_check/W0195.feature +0 -2
- data/features/code_check/W0196.feature +0 -2
- data/features/code_check/W0197.feature +0 -2
- data/features/code_check/W0198.feature +0 -2
- data/features/code_check/W0199.feature +0 -2
- data/features/code_check/W0200.feature +0 -2
- data/features/code_check/W0201.feature +0 -2
- data/features/code_check/W0202.feature +0 -2
- data/features/code_check/W0203.feature +0 -2
- data/features/code_check/W0204.feature +0 -2
- data/features/code_check/W0205.feature +0 -2
- data/features/code_check/W0206.feature +0 -2
- data/features/code_check/W0207.feature +0 -2
- data/features/code_check/W0208.feature +0 -2
- data/features/code_check/W0209.feature +0 -2
- data/features/code_check/W0210.feature +0 -2
- data/features/code_check/W0211.feature +0 -2
- data/features/code_check/W0212.feature +0 -2
- data/features/code_check/W0213.feature +0 -2
- data/features/code_check/W0214.feature +0 -2
- data/features/code_check/W0215.feature +0 -2
- data/features/code_check/W0216.feature +0 -2
- data/features/code_check/W0217.feature +0 -2
- data/features/code_check/W0218.feature +0 -2
- data/features/code_check/W0219.feature +0 -2
- data/features/code_check/W0220.feature +0 -2
- data/features/code_check/W0221.feature +0 -2
- data/features/code_check/W0222.feature +0 -2
- data/features/code_check/W0223.feature +0 -2
- data/features/code_check/W0224.feature +0 -2
- data/features/code_check/W0225.feature +0 -2
- data/features/code_check/W0226.feature +0 -2
- data/features/code_check/W0227.feature +0 -2
- data/features/code_check/W0228.feature +0 -2
- data/features/code_check/W0229.feature +0 -2
- data/features/code_check/W0230.feature +0 -2
- data/features/code_check/W0231.feature +0 -2
- data/features/code_check/W0232.feature +0 -2
- data/features/code_check/W0233.feature +0 -2
- data/features/code_check/W0234.feature +0 -2
- data/features/code_check/W0235.feature +0 -2
- data/features/code_check/W0236.feature +0 -2
- data/features/code_check/W0237.feature +0 -2
- data/features/code_check/W0238.feature +0 -2
- data/features/code_check/W0239.feature +0 -2
- data/features/code_check/W0240.feature +0 -2
- data/features/code_check/W0241.feature +0 -2
- data/features/code_check/W0242.feature +0 -2
- data/features/code_check/W0243.feature +0 -2
- data/features/code_check/W0244.feature +0 -2
- data/features/code_check/W0245.feature +0 -2
- data/features/code_check/W0246.feature +0 -2
- data/features/code_check/W0247.feature +0 -2
- data/features/code_check/W0248.feature +0 -2
- data/features/code_check/W0249.feature +0 -2
- data/features/code_check/W0250.feature +0 -2
- data/features/code_check/W0251.feature +0 -2
- data/features/code_check/W0252.feature +0 -2
- data/features/code_check/W0253.feature +0 -2
- data/features/code_check/W0254.feature +0 -2
- data/features/code_check/W0425.feature +0 -2
- data/features/code_check/W0431.feature +0 -2
- data/features/code_check/W0432.feature +0 -2
- data/features/code_check/W0477.feature +0 -2
- data/features/code_check/W0478.feature +0 -2
- data/features/code_check/W0479.feature +0 -2
- data/features/code_check/W0480.feature +0 -2
- data/features/code_check/W0481.feature +0 -2
- data/features/code_check/W0482.feature +0 -2
- data/features/code_check/W0483.feature +0 -2
- data/features/code_check/W0488.feature +132 -0
- data/features/code_check/W0489.feature +78 -0
- data/features/code_check/W0490.feature +83 -0
- data/features/code_check/W0495.feature +60 -0
- data/features/code_check/W0496.feature +63 -0
- data/features/code_check/W0497.feature +65 -0
- data/features/code_check/W0498.feature +120 -0
- data/features/code_check/W0499.feature +63 -0
- data/features/code_check/W0500.feature +66 -0
- data/features/code_check/W0501.feature +69 -0
- data/features/code_check/W0502.feature +64 -0
- data/features/code_check/W0573.feature +0 -2
- data/features/code_check/W0583.feature +0 -2
- data/features/code_check/W0606.feature +0 -2
- data/features/code_check/W0635.feature +0 -2
- data/features/code_check/W0641.feature +0 -2
- data/features/code_check/W0643.feature +0 -2
- data/features/code_check/W0644.feature +0 -2
- data/features/code_check/W0645.feature +0 -2
- data/features/code_check/W0646.feature +0 -2
- data/features/code_check/W0649.feature +0 -2
- data/features/code_check/W0650.feature +0 -2
- data/features/code_check/W0655.feature +43 -0
- data/features/code_check/W0685.feature +0 -2
- data/features/code_check/W0686.feature +0 -2
- data/features/code_check/W0687.feature +0 -2
- data/features/code_check/W0688.feature +0 -2
- data/features/code_check/W0689.feature +0 -2
- data/features/code_check/W0690.feature +0 -2
- data/features/code_check/W0691.feature +0 -2
- data/features/code_check/W0692.feature +0 -2
- data/features/code_check/W0694.feature +0 -2
- data/features/code_check/W0695.feature +0 -2
- data/features/code_check/W0697.feature +0 -2
- data/features/code_check/W0698.feature +0 -2
- data/features/code_check/W0699.feature +0 -2
- data/features/code_check/W0700.feature +0 -2
- data/features/code_check/W0703.feature +0 -2
- data/features/code_check/W0705.feature +6 -2
- data/features/code_check/W0707.feature +4 -2
- data/features/code_check/W0711.feature +0 -2
- data/features/code_check/W0712.feature +0 -2
- data/features/code_check/W0713.feature +0 -2
- data/features/code_check/W0714.feature +0 -2
- data/features/code_check/W0715.feature +0 -2
- data/features/code_check/W0716.feature +0 -2
- data/features/code_check/W0717.feature +0 -2
- data/features/code_check/W0718.feature +0 -2
- data/features/code_check/W0719.feature +0 -2
- data/features/code_check/W0723.feature +0 -2
- data/features/code_check/W0726.feature +0 -2
- data/features/code_check/W0732.feature +0 -2
- data/features/code_check/W0733.feature +0 -2
- data/features/code_check/W0734.feature +0 -2
- data/features/code_check/W0735.feature +0 -2
- data/features/code_check/W0745.feature +1 -2
- data/features/code_check/W0747.feature +0 -2
- data/features/code_check/W0748.feature +0 -2
- data/features/code_check/W0749.feature +0 -2
- data/features/code_check/W0750.feature +0 -2
- data/features/code_check/W0751.feature +0 -2
- data/features/code_check/W0752.feature +0 -2
- data/features/code_check/W0753.feature +0 -2
- data/features/code_check/W0754.feature +0 -2
- data/features/code_check/W0755.feature +0 -2
- data/features/code_check/W0756.feature +0 -2
- data/features/code_check/W0757.feature +0 -2
- data/features/code_check/W0758.feature +0 -2
- data/features/code_check/W0759.feature +0 -2
- data/features/code_check/W0760.feature +0 -2
- data/features/code_check/W0761.feature +0 -2
- data/features/code_check/W0762.feature +0 -2
- data/features/code_check/W0763.feature +0 -2
- data/features/code_check/W0764.feature +0 -2
- data/features/code_check/W0765.feature +0 -2
- data/features/code_check/W0766.feature +0 -2
- data/features/code_check/W0767.feature +0 -2
- data/features/code_check/W0768.feature +0 -2
- data/features/code_check/W0769.feature +0 -2
- data/features/code_check/W0780.feature +0 -2
- data/features/code_check/W0781.feature +0 -2
- data/features/code_check/W0783.feature +0 -2
- data/features/code_check/W0787.feature +0 -2
- data/features/code_check/W0792.feature +0 -2
- data/features/code_check/W0793.feature +0 -2
- data/features/code_check/W0794.feature +0 -2
- data/features/code_check/W0801.feature +0 -2
- data/features/code_check/W0805.feature +0 -2
- data/features/code_check/W0806.feature +0 -2
- data/features/code_check/W0807.feature +0 -2
- data/features/code_check/W0808.feature +0 -2
- data/features/code_check/W0809.feature +0 -2
- data/features/code_check/W0811.feature +0 -2
- data/features/code_check/W0830.feature +0 -2
- data/features/code_check/W0833.feature +0 -2
- data/features/code_check/W0834.feature +1 -3
- data/features/code_check/W1026.feature +0 -2
- data/features/code_check/W1030.feature +0 -2
- data/features/code_check/W1031.feature +0 -2
- data/features/code_check/W1039.feature +0 -2
- data/features/code_check/W1040.feature +0 -2
- data/features/code_check/W1041.feature +0 -2
- data/features/code_check/W1046.feature +0 -2
- data/features/code_check/W1047.feature +0 -2
- data/features/code_check/W1052.feature +0 -2
- data/features/code_check/W1066.feature +0 -2
- data/features/code_check/W1067.feature +0 -2
- data/features/code_check/W1068.feature +0 -2
- data/features/code_check/W1069.feature +0 -2
- data/features/code_check/W1070.feature +0 -2
- data/features/code_check/W1071.feature +0 -2
- data/features/code_check/W1072.feature +0 -2
- data/features/code_check/W1073.feature +1 -3
- data/features/code_check/W1074.feature +3 -4
- data/features/code_check/W1075.feature +0 -2
- data/features/code_check/W1076.feature +0 -2
- data/features/code_check/W1077.feature +0 -2
- data/features/code_check/W9001.feature +0 -2
- data/features/code_check/W9003.feature +3 -3
- data/lib/adlint/c/branch.rb +2 -2
- data/lib/adlint/c/environ.rb +3 -3
- data/lib/adlint/c/expr.rb +67 -39
- data/lib/adlint/c/interp.rb +10 -1
- data/lib/adlint/c/object.rb +6 -4
- data/lib/adlint/c/parser.rb +1 -1
- data/lib/adlint/c/value.rb +27 -10
- data/lib/adlint/cpp/constexpr.rb +1 -1
- data/lib/adlint/exam/c_builtin/c_check.rb +502 -420
- data/lib/adlint/version.rb +2 -2
- data/share/doc/developers_guide_ja.html +3 -3
- data/share/doc/developers_guide_ja.texi +1 -1
- data/share/doc/users_guide_en.html +10 -10
- data/share/doc/users_guide_en.texi +8 -8
- data/share/doc/users_guide_ja.html +10 -10
- data/share/doc/users_guide_ja.texi +8 -8
- metadata +15 -3
@@ -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:
|
data/lib/adlint/c/branch.rb
CHANGED
@@ -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(
|
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
|
|
data/lib/adlint/c/environ.rb
CHANGED
@@ -121,9 +121,9 @@ module C #:nodoc:
|
|
121
121
|
@variable_table.begin_variables_value_versioning
|
122
122
|
end
|
123
123
|
|
124
|
-
def end_versioning(
|
125
|
-
if
|
126
|
-
@variable_table.
|
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
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
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
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
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
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
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
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
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
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
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
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
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
|
-
|
1735
|
-
|
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
|
data/lib/adlint/c/interp.rb
CHANGED
@@ -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.
|
data/lib/adlint/c/object.rb
CHANGED
@@ -246,8 +246,8 @@ module C #:nodoc:
|
|
246
246
|
value.end_versioning
|
247
247
|
end
|
248
248
|
|
249
|
-
def
|
250
|
-
value.
|
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
|
681
|
+
def thin_latest_variables_value_version!(with_rollback)
|
682
682
|
@named_variables.each do |hash|
|
683
|
-
hash.each_value
|
683
|
+
hash.each_value do |variable|
|
684
|
+
variable.thin_latest_value_version!(with_rollback)
|
685
|
+
end
|
684
686
|
end
|
685
687
|
end
|
686
688
|
|
data/lib/adlint/c/parser.rb
CHANGED
data/lib/adlint/c/value.rb
CHANGED
@@ -2093,15 +2093,17 @@ module C #:nodoc:
|
|
2093
2093
|
invalidate_memo!
|
2094
2094
|
end
|
2095
2095
|
|
2096
|
-
def
|
2097
|
-
if @version_controller.
|
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
|
-
|
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
|
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
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
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
|