Class: AdLint::Cc1::FloatType

Inherits:
StandardFloatingType show all
Defined in:
lib/adlint/cc1/type.rb

Instance Attribute Summary

Attributes inherited from ScalarDataType

#bit_alignment, #bit_size

Attributes inherited from Type

#declarations, #name, #type_table

Instance Method Summary collapse

Methods inherited from StandardFloatingType

#dup, #standard?

Methods inherited from FloatingType

#bitfield?, #brief_image, #compatible?, #corresponding_signed_type, #corresponding_unsigned_type, #dup, #enum?, #enumerators, #explicitly_signed?, #floating?, #image, #incomplete?, #integer?, #integer_conversion_rank, #integer_promoted_type, #location, #max, #min, #pointer?, #signed?

Methods inherited from ScalarDataType

#_arithmetic_type_with_array, #_arithmetic_type_with_bitfield, #_arithmetic_type_with_char, #_arithmetic_type_with_double, #_arithmetic_type_with_enum, #_arithmetic_type_with_extended_big_int, #_arithmetic_type_with_float, #_arithmetic_type_with_function, #_arithmetic_type_with_int, #_arithmetic_type_with_long, #_arithmetic_type_with_long_double, #_arithmetic_type_with_long_int, #_arithmetic_type_with_long_long, #_arithmetic_type_with_long_long_int, #_arithmetic_type_with_pointer, #_arithmetic_type_with_short, #_arithmetic_type_with_short_int, #_arithmetic_type_with_signed, #_arithmetic_type_with_signed_char, #_arithmetic_type_with_signed_int, #_arithmetic_type_with_signed_long, #_arithmetic_type_with_signed_long_int, #_arithmetic_type_with_signed_long_long, #_arithmetic_type_with_signed_long_long_int, #_arithmetic_type_with_signed_short, #_arithmetic_type_with_signed_short_int, #_arithmetic_type_with_struct, #_arithmetic_type_with_undeclared, #_arithmetic_type_with_union, #_arithmetic_type_with_unresolved, #_arithmetic_type_with_unsigned, #_arithmetic_type_with_unsigned_char, #_arithmetic_type_with_unsigned_int, #_arithmetic_type_with_unsigned_long, #_arithmetic_type_with_unsigned_long_int, #_arithmetic_type_with_unsigned_long_long, #_arithmetic_type_with_unsigned_long_long_int, #_arithmetic_type_with_unsigned_short, #_arithmetic_type_with_unsigned_short_int, #_arithmetic_type_with_void, #arbitrary_value, #array?, #base_type, #bitfield?, #brief_image, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #compatible?, #const?, #corresponding_signed_type, #corresponding_unsigned_type, #dup, #enum?, #enumerators, #explicitly_signed?, #floating?, #function?, #have_va_list?, #image, #impl_length, #integer?, #integer_conversion_rank, #integer_promoted_type, #length, #location, #max, #member_named, #members, #min, #nil_value, #parameter_types, #parameter_value, #pointer?, #qualified?, #real_type, #restrict?, #return_type, #return_value, #scalar?, #signed?, #standard?, #struct?, #undeclared?, #undefined_value, #union?, #unqualify, #unresolved?, #user?, #void?, #volatile?, #zero_value

Methods included from UsualArithmeticTypeConversion

#do_usual_arithmetic_type_conversion

Methods inherited from Type

#==, #_arithmetic_type_with_array, #_arithmetic_type_with_bitfield, #_arithmetic_type_with_char, #_arithmetic_type_with_double, #_arithmetic_type_with_enum, #_arithmetic_type_with_extended_big_int, #_arithmetic_type_with_float, #_arithmetic_type_with_function, #_arithmetic_type_with_int, #_arithmetic_type_with_long, #_arithmetic_type_with_long_double, #_arithmetic_type_with_long_int, #_arithmetic_type_with_long_long, #_arithmetic_type_with_long_long_int, #_arithmetic_type_with_pointer, #_arithmetic_type_with_short, #_arithmetic_type_with_short_int, #_arithmetic_type_with_signed, #_arithmetic_type_with_signed_char, #_arithmetic_type_with_signed_int, #_arithmetic_type_with_signed_long, #_arithmetic_type_with_signed_long_int, #_arithmetic_type_with_signed_long_long, #_arithmetic_type_with_signed_long_long_int, #_arithmetic_type_with_signed_short, #_arithmetic_type_with_signed_short_int, #_arithmetic_type_with_struct, #_arithmetic_type_with_undeclared, #_arithmetic_type_with_union, #_arithmetic_type_with_unresolved, #_arithmetic_type_with_unsigned, #_arithmetic_type_with_unsigned_char, #_arithmetic_type_with_unsigned_int, #_arithmetic_type_with_unsigned_long, #_arithmetic_type_with_unsigned_long_int, #_arithmetic_type_with_unsigned_long_long, #_arithmetic_type_with_unsigned_long_long_int, #_arithmetic_type_with_unsigned_short, #_arithmetic_type_with_unsigned_short_int, #_arithmetic_type_with_void, #aligned_bit_size, #aligned_byte_size, #arbitrary_value, #array?, #base_type, #bit_alignment, #bit_size, #bitfield?, #brief_image, #byte_alignment, #byte_size, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #compatible?, #composite?, #const?, #convertible?, #corresponding_signed_type, #corresponding_unsigned_type, #dup, #enum?, #enumerators, #explicitly_signed?, #floating?, #function?, #have_va_list?, #image, #impl_length, #incomplete?, #inspect, #integer?, #integer_conversion_rank, #integer_promoted_type, #length, #length=, #location, #max, #member_named, #members, #min, #more_cv_qualified?, #nil_value, #parameter?, #parameter_types, #parameter_value, #pointer?, #qualified?, #real_type, #restrict?, #return_type, #return_value, #same_as?, #scalar?, #signed?, #standard?, #struct?, #undeclared?, #undefined_value, #union?, #unqualify, #unresolved?, #unsigned?, #user?, #void?, #volatile?, #zero_value

Methods included from StandardTypesAccessor

#char_alignment, #char_as_unsigned_char?, #char_size, #code_ptr_alignment, #code_ptr_size, #data_ptr_alignment, #data_ptr_size, #double_alignment, #double_size, #float_alignment, #float_size, #int_alignment, #int_size, #long_alignment, #long_double_alignment, #long_double_size, #long_long_alignment, #long_long_size, #long_size, #short_alignment, #short_size, #standard_types

Methods included from ArithmeticAccessor

#arithmetic, #logical_right_shift?

Methods included from Visitable

#accept

Constructor Details

#initialize(type_tbl) ⇒ FloatType

Returns a new instance of FloatType.



5381
5382
5383
5384
5385
5386
# File 'lib/adlint/cc1/type.rb', line 5381

def initialize(type_tbl)
  # FIXME: StandardTypesAccessor is not ready until @type_table is
  #        initialized.
  @type_table = type_tbl
  super(type_tbl, "float", float_size, float_alignment)
end

Instance Method Details

#argument_promoted_typeObject



5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
# File 'lib/adlint/cc1/type.rb', line 5396

def argument_promoted_type
  # NOTE: The ISO C99 standard says;
  #
  # 6.5.2.2 Function calls
  #
  # 6 If the expression that denotes the called function has a type that
  #   does not include a prototype, the integer promotions are performed on
  #   each argument, and arguments that have type float are promoted to
  #   double.  These are called the default argument promotions.  If the
  #   number of arguments does not equal the number of parameters, the
  #   behavior is undefined.  If the function is defined with a type that
  #   includes a prototype, and either the prototype ends with an ellipsis
  #   (, ...) or the types of the arguments after promotion are not
  #   compatible with the types of the parameters, the behavior is
  #   undefined.  If the function is defined with a type that does not
  #   include a prototype, and the types of the arguments after promotion
  #   are not compatible with those of the parameters after promotion, the
  #   behavior is undefined, except for the following cases:
  #
  #     -- one promoted type is a signed integer type, the other promoted
  #        type is the corresponding unsigned integer type, and the value
  #        is representable in both types;
  #     -- both types are pointers to qualified or unqualified versions of
  #        a character type or void.
  double_t
end

#arithmetic_type_with(type) ⇒ Object



5423
5424
5425
# File 'lib/adlint/cc1/type.rb', line 5423

def arithmetic_type_with(type)
  type._arithmetic_type_with_float(self)
end

#idObject



5388
5389
5390
# File 'lib/adlint/cc1/type.rb', line 5388

def id
  @id ||= FloatTypeId.new
end

#named?Boolean

Returns:

  • (Boolean)


5392
5393
5394
# File 'lib/adlint/cc1/type.rb', line 5392

def named?
  true
end