adlint 1.18.2 → 1.18.6

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,33 @@
1
+ Tue Aug 14 14:54:55 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 1.18.6
4
+ - Fix abend problem when a variable of typedefed incomplete array
5
+ type is defined with an initializer.
6
+
7
+ Tue Aug 14 10:49:35 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
8
+
9
+ * release.rc : 1.18.5
10
+ - Fix bad array length deduction in an array variable definition with
11
+ string-literal-specifier as initializer.
12
+
13
+ Tue Aug 14 10:37:24 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
14
+
15
+ * lib/adlint/c/interp.rb : Fix bad array length deduction in an array
16
+ variable definition with string-literal-specifier as initializer.
17
+
18
+ Mon Aug 13 18:14:49 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
19
+
20
+ * release.rc : 1.18.3
21
+ - Fix abend problem when a variable of typedefed incomplete array
22
+ type is defined with an initializer.
23
+
24
+ Mon Aug 13 18:01:12 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
25
+
26
+ * lib/adlint/c/interp.rb : Fix abend problem when a variable of
27
+ typedefed incomplete array type is defined with an initializer.
28
+ * lib/adlint/c/object.rb : Ditto.
29
+ * lib/adlint/c/type.rb : Ditto.
30
+
1
31
  Fri Aug 3 13:07:04 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
32
 
3
33
  * release.ga : 1.18.2
data/NEWS CHANGED
@@ -21,16 +21,23 @@
21
21
 
22
22
  ++
23
23
 
24
- === \AdLint 1.18.2 is released (2012-08-03)
24
+ === \AdLint 1.18.6 is released (2012-08-14)
25
25
 
26
- ==== Changes since the 1.18.0 release
26
+ ==== Changes since the 1.18.2 release
27
27
 
28
- * Fix gem installation problem on mswin
28
+ * Fix abend problem when a variable of typedefed incomplete array type is
29
+ defined with an initializer
29
30
 
30
31
  See the file
31
32
  {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
32
33
  for more details.
33
34
 
35
+ === \AdLint 1.18.2 is released (2012-08-03)
36
+
37
+ ==== Changes since the 1.18.0 release
38
+
39
+ * Fix gem installation problem on mswin
40
+
34
41
  === \AdLint 1.18.0 is released (2012-08-01)
35
42
 
36
43
  ==== Changes since the 1.16.0 release
@@ -36,7 +36,7 @@
36
36
  # X9999: "Your custom message for the fatal error of #9999."
37
37
  # E9999: "Your custom message for the error of #9999."
38
38
 
39
- version: "1.18.2"
39
+ version: "1.18.6"
40
40
 
41
41
  message_definition:
42
42
  X0001: "An unknown exception `%s' is found."
@@ -36,7 +36,7 @@
36
36
  # X9999: "Your custom message for the fatal error of #9999."
37
37
  # E9999: "Your custom message for the error of #9999."
38
38
 
39
- version: "1.18.2"
39
+ version: "1.18.6"
40
40
 
41
41
  message_definition:
42
42
  X0001: "不明な例外条件 `%s' を検出しました。"
@@ -585,8 +585,8 @@ module C #:nodoc:
585
585
  decl.mark_as_referred_by(node.identifier)
586
586
  end
587
587
 
588
- if initializer = node.initializer
589
- init_var, converted = evaluate_initializer(initializer, node.type)
588
+ if node.initializer
589
+ init_var, converted = evaluate_initializer(node)
590
590
  variable = define_variable(node, converted.value.to_defined_value)
591
591
 
592
592
  notify_variable_value_referred(node, init_var)
@@ -654,27 +654,33 @@ module C #:nodoc:
654
654
  end
655
655
 
656
656
  private
657
- def evaluate_initializer(initializer, variable_type)
657
+ def evaluate_initializer(definition)
658
658
  init_interp = InitializerInterpreter.new(interpreter)
659
- variable, converted = init_interp.execute(initializer, variable_type)
659
+ variable, converted = init_interp.execute(definition)
660
660
 
661
- # NOTE: An implicit conversion has been done by InitializerInterpreter.
661
+ # NOTE: An implicit conversion and size deduction of an incomplete array
662
+ # have been done by InitializerInterpreter.
662
663
 
663
664
  # NOTE: For the case of array variable definition with a
664
665
  # string-literal-specifier as the initializer.
665
- if variable_type.array? && variable.type.pointer?
666
+ if definition.type.array? && variable.type.pointer?
666
667
  unless array = pointee_of(variable) and array.type.array?
667
- array = temporary_variable(variable_type)
668
+ array = temporary_variable(definition.type)
668
669
  end
669
- deduct_array_length_from_array_variable(variable_type, array)
670
+ deduct_array_length_from_array_variable(definition, array)
670
671
  variable = converted = array
671
672
  end
672
673
 
673
674
  return variable, converted
674
675
  end
675
676
 
676
- def deduct_array_length_from_array_variable(variable_type, array_variable)
677
- variable_type.length ||= array_variable.type.length
677
+ def deduct_array_length_from_array_variable(definition, array)
678
+ unless definition.type.length
679
+ if definition.type.user?
680
+ definition.type = definition.type.dup
681
+ end
682
+ definition.type.length = array.type.length
683
+ end
678
684
  end
679
685
 
680
686
  def evaluate_sequence_point(full_declarator)
@@ -694,27 +700,33 @@ module C #:nodoc:
694
700
  @interpreter = interpreter
695
701
  end
696
702
 
697
- def execute(initializer, variable_type)
698
- checkpoint(initializer.location)
703
+ def execute(definition)
704
+ checkpoint(definition.initializer.location)
699
705
 
700
706
  case
701
- when expression = initializer.expression
707
+ when expression = definition.initializer.expression
702
708
  # NOTE: An implicit conversion is already notified in
703
709
  # #evaluate_expression.
704
- return evaluate_expression(expression, variable_type)
705
- when initializers = initializer.initializers
706
- variable = evaluate_initializers(initializers, variable_type)
710
+ return evaluate_expression(expression, definition.type)
711
+ when initializers = definition.initializer.initializers
712
+ variable = evaluate_initializers(initializers, definition.type)
713
+
714
+ # NOTE: Size deduction of an incomplete array type have been done by
715
+ # #evaluate_initializers.
716
+ if definition.type.array? && variable.type.array?
717
+ definition.type = variable.type unless definition.type.length
718
+ end
707
719
 
708
- if variable.type.same_as?(variable_type)
720
+ if variable.type.same_as?(definition.type)
709
721
  converted = variable
710
722
  else
711
723
  converted =
712
- do_conversion(variable, variable_type) ||
713
- temporary_variable(variable_type)
724
+ do_conversion(variable, definition.type) ||
725
+ temporary_variable(definition.type)
714
726
  notify_implicit_conv_performed(initializer, variable, converted)
715
727
  end
716
728
  else
717
- variable = converted = temporary_variable(variable_type)
729
+ variable = converted = temporary_variable(definition.type)
718
730
  end
719
731
 
720
732
  return variable, converted
@@ -741,70 +753,97 @@ module C #:nodoc:
741
753
  return variable, converted
742
754
  end
743
755
 
744
- def evaluate_initializers(initializers, variable_type)
745
- # NOTE: The ISO C99 standard saids;
746
- #
747
- # 6.7.8 Initialization
748
- #
749
- # Semantics
750
- #
751
- # 10 If an object that has automatic storage duration is not initialized
752
- # explicitly, its value is indeterminate. If an object that has
753
- # static storage duration is not initialized explicitly, then:
754
- # -- if it has pointer type, it is initialized to a null pointer;
755
- # -- if it has arithmetic type, it is initialized to (positive or
756
- # unsigned) zero;
757
- # -- if it is an aggregate, every member is initialized (recursively)
758
- # according to these rules;
759
- # -- if it is a union, the first named member is initialized
760
- # (recursively) according to these rules.
761
- if variable_type.union?
762
- if first_member = variable_type.members.first
763
- first_object = evaluate_initializers(initializers, first_member.type)
764
- return temporary_variable(variable_type, value_of(first_object))
765
- else
766
- return temporary_variable(variable_type)
767
- end
756
+ def evaluate_initializers(initializers, type)
757
+ if type.union?
768
758
  end
769
759
 
770
760
  case
771
- when variable_type.array?
772
- deduct_array_length_from_initializers(variable_type, initializers)
773
- member_types = [variable_type.base_type] * variable_type.impl_length
774
- when variable_type.struct?
775
- member_types = variable_type.members.map { |member| member.type }
761
+ when type.union?
762
+ # NOTE: The ISO C99 standard saids;
763
+ #
764
+ # 6.7.8 Initialization
765
+ #
766
+ # Semantics
767
+ #
768
+ # 10 If an object that has automatic storage duration is not
769
+ # initialized explicitly, its value is indeterminate. If an object
770
+ # that has static storage duration is not initialized explicitly,
771
+ # then:
772
+ # -- if it has pointer type, it is initialized to a null pointer;
773
+ # -- if it has arithmetic type, it is initialized to (positive or
774
+ # unsigned) zero;
775
+ # -- if it is an aggregate, every member is initialized
776
+ # (recursively) according to these rules;
777
+ # -- if it is a union, the first named member is initialized
778
+ # (recursively) according to these rules.
779
+ if first_member = type.members.first
780
+ first_object = evaluate_initializers(initializers, first_member.type)
781
+ return temporary_variable(type, value_of(first_object))
782
+ else
783
+ return temporary_variable(type)
784
+ end
785
+ when type.array?
786
+ # NOTE: The ISO C99 standard saids;
787
+ #
788
+ # 6.7.2.1 Structure and union specifiers
789
+ #
790
+ # Constraints
791
+ #
792
+ # 2 A structure or union shall not contain a member with incomplete
793
+ # or function type (hence, a structure shall not contain an
794
+ # instance of itself, but may contain a pointer to an instance of
795
+ # itself), except that the last member of a structure with more
796
+ # than one named member may have incomplete array type; such a
797
+ # structure (and any union containing, possibly recursively, a
798
+ # member that is such a structure) shall not be a member of a
799
+ # structure or an element of an array.
800
+ #
801
+ # NOTE: Size of the last incomplete array member should not be
802
+ # deducted in initialization. It is treated as a pointer.
803
+ #
804
+ # NOTE: ISO C90 does not support flexible array members.
805
+ type = deduct_array_length_from_initializers(type, initializers)
806
+ member_types = [type.unqualify.base_type] * type.impl_length
807
+ when type.struct?
808
+ member_types = type.members.map { |member| member.type }
776
809
  else
777
- member_types = [variable_type]
810
+ member_types = [type]
778
811
  end
779
812
 
780
- values = member_types.zip(initializers).map { |type, initializer|
813
+ values = member_types.zip(initializers).map { |memb_type, initializer|
781
814
  if initializer
782
815
  checkpoint(initializer.location)
783
816
  case
784
817
  when expression = initializer.expression
785
- value_of(evaluate_expression(expression, type).last)
818
+ value_of(evaluate_expression(expression, memb_type).last)
786
819
  when initializers = initializer.initializers
787
- value_of(evaluate_initializers(initializers, type))
820
+ value_of(evaluate_initializers(initializers, memb_type))
788
821
  else
789
- type.undefined_value
822
+ memb_type.undefined_value
790
823
  end
791
824
  else
792
- type.undefined_value
825
+ memb_type.undefined_value
793
826
  end
794
827
  }
795
828
 
796
829
  case
797
- when variable_type.array?
798
- temporary_variable(variable_type, ArrayValue.new(values))
799
- when variable_type.composite?
800
- temporary_variable(variable_type, CompositeValue.new(values))
830
+ when type.array?
831
+ temporary_variable(type, ArrayValue.new(values))
832
+ when type.composite?
833
+ temporary_variable(type, CompositeValue.new(values))
801
834
  else
802
- temporary_variable(variable_type, values.first)
835
+ temporary_variable(type, values.first)
803
836
  end
804
837
  end
805
838
 
806
- def deduct_array_length_from_initializers(variable_type, initializers)
807
- variable_type.length ||= initializers.size
839
+ def deduct_array_length_from_initializers(orig_array_type, initializers)
840
+ unless orig_array_type.length
841
+ if orig_array_type.user?
842
+ orig_array_type = orig_array_type.dup
843
+ end
844
+ orig_array_type.length = initializers.size
845
+ end
846
+ orig_array_type
808
847
  end
809
848
 
810
849
  def interpreter
@@ -304,7 +304,7 @@ module C #:nodoc:
304
304
  super(memory, declaration_or_definition, type, scope)
305
305
 
306
306
  # TODO: If too slow, make an index of inner variables.
307
- @inner_variables = create_inner_variables(type, scope)
307
+ @inner_variables = create_inner_variables(type.unqualify, scope)
308
308
  end
309
309
 
310
310
  def enter_value_versioning_group
@@ -573,8 +573,7 @@ module C #:nodoc:
573
573
  class AliasVariable < NamedVariable
574
574
  def initialize(variable)
575
575
  super(variable.binding.memory,
576
- variable.declarations_and_definitions.first,
577
- variable.scope)
576
+ variable.declarations_and_definitions.first, variable.scope)
578
577
  end
579
578
 
580
579
  private
@@ -1116,9 +1115,9 @@ module C #:nodoc:
1116
1115
 
1117
1116
  def write(value)
1118
1117
  super
1119
- if !@windows.empty? &&
1120
- (@value.array? && value.array?) ||
1121
- (@value.composite? && value.composite?)
1118
+ if !@windows.empty? and
1119
+ @value.array? && value.array? or
1120
+ @value.composite? && value.composite?
1122
1121
  single_value = value.to_single_value
1123
1122
  @windows.zip(single_value.values).each do |window, inner_value|
1124
1123
  window.write(inner_value, false)
data/lib/adlint/c/type.rb CHANGED
@@ -341,6 +341,10 @@ module C #:nodoc:
341
341
  subclass_responsibility
342
342
  end
343
343
 
344
+ def length=(len)
345
+ subclass_responsibility
346
+ end
347
+
344
348
  def impl_length
345
349
  subclass_responsibility
346
350
  end
@@ -590,6 +594,10 @@ module C #:nodoc:
590
594
  end
591
595
  end
592
596
 
597
+ def dup
598
+ subclass_responsibility
599
+ end
600
+
593
601
  def inspect
594
602
  if @name == image
595
603
  if location
@@ -1144,6 +1152,10 @@ module C #:nodoc:
1144
1152
  def corresponding_unsigned_type
1145
1153
  self # NOTREACHED
1146
1154
  end
1155
+
1156
+ def dup
1157
+ UndeclaredType.new(type_table)
1158
+ end
1147
1159
  end
1148
1160
 
1149
1161
  class UnresolvedType < Type
@@ -1651,6 +1663,10 @@ module C #:nodoc:
1651
1663
  def corresponding_unsigned_type
1652
1664
  self # NOTREACHED
1653
1665
  end
1666
+
1667
+ def dup
1668
+ UnresolvedType.new(type_table)
1669
+ end
1654
1670
  end
1655
1671
 
1656
1672
  class QualifiedType < Type
@@ -1663,10 +1679,6 @@ module C #:nodoc:
1663
1679
 
1664
1680
  attr_reader :base_type
1665
1681
 
1666
- def declarations
1667
- @base_type.declarations
1668
- end
1669
-
1670
1682
  def id
1671
1683
  @id ||= QualifiedTypeId.new(@base_type, @cvr_qualifiers)
1672
1684
  end
@@ -1679,37 +1691,21 @@ module C #:nodoc:
1679
1691
  @brief_image ||= create_brief_image(@base_type, @cvr_qualifiers)
1680
1692
  end
1681
1693
 
1682
- def location
1683
- @base_type.location
1684
- end
1685
-
1686
- def bit_size
1687
- @base_type.bit_size
1688
- end
1694
+ extend Forwardable
1689
1695
 
1690
- def bit_alignment
1691
- @base_type.bit_alignment
1692
- end
1696
+ def_delegator :@base_type, :declarations
1697
+ def_delegator :@base_type, :location
1698
+ def_delegator :@base_type, :bit_size
1699
+ def_delegator :@base_type, :bit_alignment
1693
1700
 
1694
1701
  def real_type
1695
1702
  type_table.qualified_type(@base_type.real_type, *@cvr_qualifiers)
1696
1703
  end
1697
1704
 
1698
- def unqualify
1699
- @base_type.unqualify
1700
- end
1701
-
1702
- def incomplete?
1703
- @base_type.incomplete?
1704
- end
1705
-
1706
- def compatible?(to_type)
1707
- @base_type.compatible?(to_type)
1708
- end
1709
-
1710
- def coercible?(to_type)
1711
- @base_type.coercible?(to_type)
1712
- end
1705
+ def_delegator :@base_type, :unqualify
1706
+ def_delegator :@base_type, :incomplete?
1707
+ def_delegator :@base_type, :compatible?
1708
+ def_delegator :@base_type, :coercible?
1713
1709
 
1714
1710
  def more_cv_qualified?(than_type)
1715
1711
  # NOTE: The term `more cv-qualified' means:
@@ -1733,65 +1729,25 @@ module C #:nodoc:
1733
1729
  end
1734
1730
  end
1735
1731
 
1736
- def scalar?
1737
- @base_type.scalar?
1738
- end
1739
-
1740
- def integer?
1741
- @base_type.integer?
1742
- end
1743
-
1744
- def floating?
1745
- @base_type.floating?
1746
- end
1747
-
1748
- def array?
1749
- @base_type.array?
1750
- end
1751
-
1752
- def struct?
1753
- @base_type.struct?
1754
- end
1755
-
1756
- def union?
1757
- @base_type.union?
1758
- end
1759
-
1760
- def pointer?
1761
- @base_type.pointer?
1762
- end
1732
+ def_delegator :@base_type, :scalar?
1733
+ def_delegator :@base_type, :integer?
1734
+ def_delegator :@base_type, :floating?
1735
+ def_delegator :@base_type, :array?
1736
+ def_delegator :@base_type, :struct?
1737
+ def_delegator :@base_type, :union?
1738
+ def_delegator :@base_type, :pointer?
1763
1739
 
1764
1740
  def qualified?
1765
1741
  true
1766
1742
  end
1767
1743
 
1768
- def function?
1769
- @base_type.function?
1770
- end
1771
-
1772
- def enum?
1773
- @base_type.enum?
1774
- end
1775
-
1776
- def user?
1777
- @base_type.user?
1778
- end
1779
-
1780
- def void?
1781
- @base_type.void?
1782
- end
1783
-
1784
- def standard?
1785
- @base_type.standard?
1786
- end
1787
-
1788
- def undeclared?
1789
- @base_type.undeclared?
1790
- end
1791
-
1792
- def unresolved?
1793
- @base_type.unresolved?
1794
- end
1744
+ def_delegator :@base_type, :function?
1745
+ def_delegator :@base_type, :enum?
1746
+ def_delegator :@base_type, :user?
1747
+ def_delegator :@base_type, :void?
1748
+ def_delegator :@base_type, :standard?
1749
+ def_delegator :@base_type, :undeclared?
1750
+ def_delegator :@base_type, :unresolved?
1795
1751
 
1796
1752
  def const?
1797
1753
  @cvr_qualifiers.include?(:const)
@@ -1805,107 +1761,32 @@ module C #:nodoc:
1805
1761
  @cvr_qualifiers.include?(:restrict)
1806
1762
  end
1807
1763
 
1808
- def bitfield?
1809
- @base_type.bitfield?
1810
- end
1811
-
1812
- def signed?
1813
- @base_type.signed?
1814
- end
1815
-
1816
- def explicitly_signed?
1817
- @base_type.explicitly_signed?
1818
- end
1819
-
1820
- def have_va_list?
1821
- @base_type.have_va_list?
1822
- end
1823
-
1824
- def return_type
1825
- @base_type.return_type
1826
- end
1827
-
1828
- def parameter_types
1829
- @base_type.parameter_types
1830
- end
1831
-
1832
- def enumerators
1833
- @base_type.enumerators
1834
- end
1835
-
1836
- def length
1837
- @base_type.length
1838
- end
1839
-
1840
- def impl_length
1841
- @base_type.impl_length
1842
- end
1843
-
1844
- def members
1845
- @base_type.members
1846
- end
1847
-
1848
- def member_named(name)
1849
- @base_type.member_named(name)
1850
- end
1851
-
1852
- def min_value
1853
- @base_type.min_value
1854
- end
1855
-
1856
- def max_value
1857
- @base_type.max_value
1858
- end
1859
-
1860
- def nil_value
1861
- @base_type.nil_value
1862
- end
1863
-
1864
- def zero_value
1865
- @base_type.zero_value
1866
- end
1867
-
1868
- def arbitrary_value
1869
- @base_type.arbitrary_value
1870
- end
1871
-
1872
- def undefined_value
1873
- @base_type.undefined_value
1874
- end
1875
-
1876
- def parameter_value
1877
- @base_type.parameter_value
1878
- end
1879
-
1880
- def return_value
1881
- @base_type.return_value
1882
- end
1883
-
1884
- def coerce_scalar_value(value)
1885
- @base_type.coerce_scalar_value(value)
1886
- end
1887
-
1888
- def coerce_array_value(value)
1889
- @base_type.coerce_array_value(value)
1890
- end
1891
-
1892
- def coerce_composite_value(value)
1893
- @base_type.coerce_composite_value(value)
1894
- end
1895
-
1896
- def integer_conversion_rank
1897
- @base_type.integer_conversion_rank
1898
- end
1899
-
1900
- def integer_promoted_type
1901
- @base_type.integer_promoted_type
1902
- end
1903
-
1904
- def argument_promoted_type
1905
- @base_type.argument_promoted_type
1906
- end
1907
-
1908
- extend Forwardable
1764
+ def_delegator :@base_type, :bitfield?
1765
+ def_delegator :@base_type, :signed?
1766
+ def_delegator :@base_type, :explicitly_signed?
1767
+ def_delegator :@base_type, :have_va_list?
1768
+ def_delegator :@base_type, :return_type
1769
+ def_delegator :@base_type, :parameter_types
1770
+ def_delegator :@base_type, :enumerators
1771
+ def_delegator :@base_type, :length
1772
+ def_delegator :@base_type, :length=
1773
+ def_delegator :@base_type, :impl_length
1774
+ def_delegator :@base_type, :members
1775
+ def_delegator :@base_type, :member_named
1776
+ def_delegator :@base_type, :min_value
1777
+ def_delegator :@base_type, :max_value
1778
+ def_delegator :@base_type, :nil_value
1779
+ def_delegator :@base_type, :zero_value
1780
+ def_delegator :@base_type, :arbitrary_value
1781
+ def_delegator :@base_type, :undefined_value
1782
+ def_delegator :@base_type, :parameter_value
1783
+ def_delegator :@base_type, :return_value
1784
+ def_delegator :@base_type, :coerce_scalar_value
1785
+ def_delegator :@base_type, :coerce_array_value
1786
+ def_delegator :@base_type, :coerce_composite_value
1787
+ def_delegator :@base_type, :integer_conversion_rank
1788
+ def_delegator :@base_type, :integer_promoted_type
1789
+ def_delegator :@base_type, :argument_promoted_type
1909
1790
 
1910
1791
  def_delegator :@base_type, :arithmetic_type_with
1911
1792
  def_delegator :@base_type, :_arithmetic_type_with_undeclared
@@ -1952,6 +1833,10 @@ module C #:nodoc:
1952
1833
  def_delegator :@base_type, :corresponding_signed_type
1953
1834
  def_delegator :@base_type, :corresponding_unsigned_type
1954
1835
 
1836
+ def dup
1837
+ QualifiedType.new(type_table, @base_type.dup, *@cvr_qualifiers)
1838
+ end
1839
+
1955
1840
  private
1956
1841
  def create_name(base_type, cvr_qualifiers)
1957
1842
  append_cvr_qualifiers(base_type.name, cvr_qualifiers)
@@ -2487,6 +2372,10 @@ module C #:nodoc:
2487
2372
  def corresponding_unsigned_type
2488
2373
  self # NOTREACHED
2489
2374
  end
2375
+
2376
+ def dup
2377
+ VoidType.new(type_table)
2378
+ end
2490
2379
  end
2491
2380
 
2492
2381
  class FunctionType < Type
@@ -3019,6 +2908,11 @@ module C #:nodoc:
3019
2908
  end
3020
2909
  end
3021
2910
 
2911
+ def dup
2912
+ FunctionType.new(type_table, @return_type.dup,
2913
+ @parameter_types.map { |t| t.dup }, @have_va_list)
2914
+ end
2915
+
3022
2916
  private
3023
2917
  def create_name(return_type, parameter_types, have_va_list)
3024
2918
  "#{return_type.name}(" +
@@ -3467,6 +3361,10 @@ module C #:nodoc:
3467
3361
  def corresponding_unsigned_type
3468
3362
  subclass_responsibility
3469
3363
  end
3364
+
3365
+ def dup
3366
+ subclass_responsibility
3367
+ end
3470
3368
  end
3471
3369
 
3472
3370
  class IntegerType < ScalarDataType
@@ -3619,6 +3517,10 @@ module C #:nodoc:
3619
3517
  def corresponding_unsigned_type
3620
3518
  subclass_responsibility
3621
3519
  end
3520
+
3521
+ def dup
3522
+ subclass_responsibility
3523
+ end
3622
3524
  end
3623
3525
 
3624
3526
  class StandardIntegerType < IntegerType
@@ -3665,6 +3567,10 @@ module C #:nodoc:
3665
3567
  def corresponding_unsigned_type
3666
3568
  subclass_responsibility
3667
3569
  end
3570
+
3571
+ def dup
3572
+ self.class.new(type_table)
3573
+ end
3668
3574
  end
3669
3575
 
3670
3576
  class CharType < StandardIntegerType
@@ -4022,7 +3928,6 @@ module C #:nodoc:
4022
3928
  def corresponding_unsigned_type
4023
3929
  unsigned_short_int_type
4024
3930
  end
4025
-
4026
3931
  end
4027
3932
 
4028
3933
  class ShortIntTypeId < StandardTypeId
@@ -4966,6 +4871,10 @@ module C #:nodoc:
4966
4871
  def corresponding_unsigned_type
4967
4872
  self # NOTREACHED
4968
4873
  end
4874
+
4875
+ def dup
4876
+ BitfieldType.new(type_table, @base_type.dup, bit_size)
4877
+ end
4969
4878
  end
4970
4879
 
4971
4880
  class BitfieldTypeId < TypeId
@@ -5096,6 +5005,10 @@ module C #:nodoc:
5096
5005
  def corresponding_unsigned_type
5097
5006
  unsigned_int_type
5098
5007
  end
5008
+
5009
+ def dup
5010
+ EnumType.new(type_table, declarations.first)
5011
+ end
5099
5012
  end
5100
5013
 
5101
5014
  class EnumTypeId < TypeId
@@ -5210,6 +5123,10 @@ module C #:nodoc:
5210
5123
  self # NOTREACHED
5211
5124
  end
5212
5125
 
5126
+ def dup
5127
+ PointerType.new(type_table, @base_type.dup)
5128
+ end
5129
+
5213
5130
  private
5214
5131
  def create_name(base_type)
5215
5132
  if base_type.function?
@@ -5374,6 +5291,10 @@ module C #:nodoc:
5374
5291
  self # NOTREACHED
5375
5292
  end
5376
5293
 
5294
+ def dup
5295
+ subclass_responsibility
5296
+ end
5297
+
5377
5298
  private
5378
5299
  def fraction_bit_size
5379
5300
  subclass_responsibility
@@ -5388,6 +5309,10 @@ module C #:nodoc:
5388
5309
  def standard?
5389
5310
  true
5390
5311
  end
5312
+
5313
+ def dup
5314
+ self.class.new(type_table)
5315
+ end
5391
5316
  end
5392
5317
 
5393
5318
  class FloatType < StandardFloatingType
@@ -6097,6 +6022,10 @@ module C #:nodoc:
6097
6022
  self # NOTREACHED
6098
6023
  end
6099
6024
 
6025
+ def dup
6026
+ ArrayType.new(type_table, @base_type.dup, @length)
6027
+ end
6028
+
6100
6029
  private
6101
6030
  def create_name(base_type, length)
6102
6031
  "(#{base_type.name})[#{length ? length : ""}]"
@@ -6671,6 +6600,11 @@ module C #:nodoc:
6671
6600
  def corresponding_unsigned_type
6672
6601
  self # NOTREACHED
6673
6602
  end
6603
+
6604
+ def dup
6605
+ self.class.new(type_table, declarations.first,
6606
+ @members.map { |memb| memb.dup })
6607
+ end
6674
6608
  end
6675
6609
 
6676
6610
  class Member
@@ -6681,6 +6615,10 @@ module C #:nodoc:
6681
6615
 
6682
6616
  attr_reader :name
6683
6617
  attr_reader :type
6618
+
6619
+ def dup
6620
+ Member.new(@name, @type.dup)
6621
+ end
6684
6622
  end
6685
6623
 
6686
6624
  class StructType < CompositeDataType
@@ -6830,6 +6768,7 @@ module C #:nodoc:
6830
6768
  def_delegator :@base_type, :parameter_types
6831
6769
  def_delegator :@base_type, :enumerators
6832
6770
  def_delegator :@base_type, :length
6771
+ def_delegator :@base_type, :length=
6833
6772
  def_delegator :@base_type, :impl_length
6834
6773
  def_delegator :@base_type, :members
6835
6774
  def_delegator :@base_type, :member_named
@@ -6892,6 +6831,10 @@ module C #:nodoc:
6892
6831
 
6893
6832
  def_delegator :@base_type, :corresponding_signed_type
6894
6833
  def_delegator :@base_type, :corresponding_unsigned_type
6834
+
6835
+ def dup
6836
+ UserType.new(type_table, declarations.first, @base_type.dup)
6837
+ end
6895
6838
  end
6896
6839
 
6897
6840
  class UserTypeId < TypeId
@@ -7041,6 +6984,10 @@ module C #:nodoc:
7041
6984
 
7042
6985
  def_delegator :@type, :corresponding_signed_type
7043
6986
  def_delegator :@type, :corresponding_unsigned_type
6987
+
6988
+ def dup
6989
+ ParameterType.new(type_table, @type.dup, @declaration_or_definition)
6990
+ end
7044
6991
  end
7045
6992
 
7046
6993
  class ExtendedBigIntType < IntegerType
@@ -7129,6 +7076,10 @@ module C #:nodoc:
7129
7076
  def corresponding_unsigned_type
7130
7077
  self
7131
7078
  end
7079
+
7080
+ def dup
7081
+ ExtendedBigIntType.new(type_table)
7082
+ end
7132
7083
  end
7133
7084
 
7134
7085
  class StandardTypeCatalog
@@ -33,8 +33,8 @@ module AdLint #:nodoc:
33
33
 
34
34
  MAJOR_VERSION = 1
35
35
  MINOR_VERSION = 18
36
- PATCH_VERSION = 2
37
- RELEASE_DATE = "2012-08-03"
36
+ PATCH_VERSION = 6
37
+ RELEASE_DATE = "2012-08-14"
38
38
 
39
39
  TRAITS_SCHEMA_VERSION = "1.0.0"
40
40
 
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 1.18.2 開発者ガイド</title>
3
+ <title>AdLint 1.18.6 開発者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.18.2 開発者ガイド">
5
+ <meta name="description" content="AdLint 1.18.6 開発者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.18.2 開発者ガイド</h1>
47
+ <h1 class="settitle">AdLint 1.18.6 開発者ガイド</h1>
48
48
  <div class="contents">
49
49
  <h2>Table of Contents</h2>
50
50
  <ul>
@@ -2,7 +2,7 @@
2
2
  @setfilename developers_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.18.2 開発者ガイド
5
+ @settitle AdLint 1.18.6 開発者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="en">
2
2
  <head>
3
- <title>AdLint 1.18.2 User's Guide</title>
3
+ <title>AdLint 1.18.6 User's Guide</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.18.2 User's Guide">
5
+ <meta name="description" content="AdLint 1.18.6 User's Guide">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.18.2 User's Guide</h1>
47
+ <h1 class="settitle">AdLint 1.18.6 User's Guide</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_en.info
3
3
  @documentlanguage en
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.18.2 User's Guide
5
+ @settitle AdLint 1.18.6 User's Guide
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 1.18.2 利用者ガイド</title>
3
+ <title>AdLint 1.18.6 利用者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.18.2 利用者ガイド">
5
+ <meta name="description" content="AdLint 1.18.6 利用者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.18.2 利用者ガイド</h1>
47
+ <h1 class="settitle">AdLint 1.18.6 利用者ガイド</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -28900,7 +28900,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
28900
28900
  <h4 class="subsection">6.482.2 内容</h4>
28901
28901
 
28902
28902
  <p>ローカルで <code>static</code> な変数のアドレスが、結合またはより広いスコープを持つポインタに代入されています。
28903
- 静的記憶域期間を持つため、危険ではありませんが、C++ におけるデータ隠蔽の原則に反します。
28903
+ 静的記憶域期間を持つため、危険ではありませんが、データ隠蔽の原則に反します。
28904
28904
 
28905
28905
  <h4 class="subsection">6.482.3 サンプルコード</h4>
28906
28906
 
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.18.2 利用者ガイド
5
+ @settitle AdLint 1.18.6 利用者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -25040,7 +25040,7 @@ void func(int a)
25040
25040
  @subsection 内容
25041
25041
 
25042
25042
  ローカルで @code{static} な変数のアドレスが、結合またはより広いスコープを持つポインタに代入されています。
25043
- 静的記憶域期間を持つため、危険ではありませんが、C++ におけるデータ隠蔽の原則に反します。
25043
+ 静的記憶域期間を持つため、危険ではありませんが、データ隠蔽の原則に反します。
25044
25044
 
25045
25045
  @subsection サンプルコード
25046
25046
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.2
4
+ version: 1.18.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-03 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'AdLint is a source code static analyzer.
15
15