class AdLint::Cc1::CharType

Public Class Methods

new(type_tbl) click to toggle source
Calls superclass method AdLint::Cc1::IntegerType::new
# File lib/adlint/cc1/type.rb, line 3617
def initialize(type_tbl)
  # FIXME: StandardTypesAccessor is not ready until @type_table is
  #        initialized.
  @type_table = type_tbl
  super(type_tbl, "char",
        char_size, char_alignment, !char_as_unsigned_char?, false)
end

Public Instance Methods

arithmetic_type_with(type) click to toggle source
# File lib/adlint/cc1/type.rb, line 3670
def arithmetic_type_with(type)
  type._arithmetic_type_with_char(self)
end
corresponding_signed_type() click to toggle source
# File lib/adlint/cc1/type.rb, line 3674
def corresponding_signed_type
  signed_char_t
end
corresponding_unsigned_type() click to toggle source
# File lib/adlint/cc1/type.rb, line 3678
def corresponding_unsigned_type
  unsigned_char_t
end
id() click to toggle source
# File lib/adlint/cc1/type.rb, line 3625
def id
  # NOTE: `char' type may be treated as `unsigned char'.
  #       Specialized type comparison is implemented in CharTypeId,
  #       SignedCharTypeId and UnsignedCharTypeId.
  @id ||= CharTypeId.new(char_as_unsigned_char?)
end
integer_conversion_rank() click to toggle source
# File lib/adlint/cc1/type.rb, line 3632
def integer_conversion_rank
  # NOTE: The ISO C99 standard says;
  #
  # 6.3.1 Arithmetic operands
  # 6.3.1.1 Boolean, characters, and integers
  #
  # 1 Every integer type has an integer conversion rank defined as follows:
  #
  #     -- No two signed integer types shall have the same rank, even if
  #        they have the same representation.
  #     -- The rank of a signed integer type shall be greater than the rank
  #        of any signed integer type with less precision.
  #     -- The rank of long long int shall be greater than the rank of long
  #        int, which shall be greater than the rank of int, which shall be
  #        greater than the rank of short int, which shall be greater than
  #        the rank of signed char.
  #     -- The rank of any unsigned integer type shall equal the rank of
  #        the corresponding signed integer type, if any.
  #     -- The rank of any standard integer type shall be greater than the
  #        rank of any extended integer type with the same width.
  #     -- The rank of char shall equal the rank of signed char and
  #        unsigned char.
  #     -- The rank of _Bool shall be less than the rank of all other
  #        standard integer types.
  #     -- The rank of any enumerated type shall equal the rank of the
  #        compatible integer type.
  #     -- The rank of any extended signed integer type relative to another
  #        extended signed integer type with the same precision is
  #        implementation-defined, but still subject to the other rules for
  #        determining the integer conversion rank.
  #     -- For all integer types T1, T2, and T3, if T1 has greater rank
  #        than T2 and T2 has greater rank than T3, then T1 has greater
  #        rank than T3.
  #
  # NOTE: char = 1, short int = 2, int = 3, long int = 4, long long int = 5
  1
end