class AdLint::Cc1::ScanfFormat::Conversion_d

Public Class Methods

new(fmt, trailing_args, env, as_char, field_width, len_mod, cs_char, scanset) click to toggle source
# File lib/adlint/cc1/format.rb, line 2540
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
               cs_char, scanset)
  super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
        cs_char, scanset)
end
suitable_conversion_specifier_character() click to toggle source
# File lib/adlint/cc1/format.rb, line 2536
def self.suitable_conversion_specifier_character
  "d"
end

Public Instance Methods

valid_assignment_suppressing_character?() click to toggle source
# File lib/adlint/cc1/format.rb, line 2546
def valid_assignment_suppressing_character?
  true
end
valid_conversion_specifier_character?() click to toggle source
# File lib/adlint/cc1/format.rb, line 2554
def valid_conversion_specifier_character?
  true
end
valid_field_width?() click to toggle source
# File lib/adlint/cc1/format.rb, line 2550
def valid_field_width?
  true
end
valid_scanset?() click to toggle source
# File lib/adlint/cc1/format.rb, line 2558
def valid_scanset?
  true
end

Private Instance Methods

argument_types() click to toggle source
# File lib/adlint/cc1/format.rb, line 2563
def argument_types
  # NOTE: The ISO C99 standard says;
  #
  # 7.19.6.2 The fscanf function
  #
  # 11 The length modifiers and their meanings are:
  #
  #    hh Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to signed
  #       char or unsigned char.
  #    h  Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to short int
  #       or unsigned short int.
  #    l  Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to long int
  #       or unsigned long int; that a following a, A, e, E, f, F, g, or
  #       G conversion specifier applies to an argument with type pointer
  #       to double; or that a following c, s, or [ conversion specifier
  #       applies to an argument with type pointer to wchar_t.
  #    ll Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to long long
  #       int or unsigned long long int.
  #    j  Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to intmax_t
  #       or uintmax_t.
  #    z  Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to size_t or
  #       the corresponding signed integer type.
  #    t  Specifies that a following d, i, o, u, x, X, or n conversion
  #       specifier applies to an argument with type pointer to ptrdiff_t
  #       or the corresponding unsigned integer type.
  case length_modifier
  when "hh"
    [pointer_type(signed_char_t), pointer_type(unsigned_char_t)]
  when "h"
    [pointer_type(signed_short_t), pointer_type(unsigned_short_t)]
  when "l"
    [pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
  when "ll"
    [pointer_type(signed_long_long_t),
      pointer_type(unsigned_long_long_t)]
  when "j"
    # FIXME: `intmax_t' and `uintmax_t' are not supported yet.
    [pointer_type(signed_long_long_t),
      pointer_type(unsigned_long_long_t)]
  when "z"
    # FIXME: `size_t' is not supported yet.
    [pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
  when "t"
    # FIXME: `ptrdiff_t' is not supported yet.
    [pointer_type(signed_int_t), pointer_type(unsigned_int_t)]
  else
    default_argument_types
  end
end
default_argument_types() click to toggle source
# File lib/adlint/cc1/format.rb, line 2623
def default_argument_types
  [pointer_type(signed_int_t)]
end
suitable_length_modifiers() click to toggle source
# File lib/adlint/cc1/format.rb, line 2619
def suitable_length_modifiers
  ["hh", "h", "l", "ll", "j", "z", "t"]
end