class AdLint::Cc1::PrintfFormat::Conversion_n

Public Class Methods

new(fmt, trailing_args, env, flags, field_width, prec, len_mod, cs_char) click to toggle source
# File lib/adlint/cc1/format.rb, line 1424
def initialize(fmt, trailing_args, env, flags, field_width, prec,
               len_mod, cs_char)
  super(fmt, trailing_args, env, true, flags, field_width, prec, len_mod,
        cs_char)
end
suitable_conversion_specifier_character() click to toggle source
# File lib/adlint/cc1/format.rb, line 1420
def self.suitable_conversion_specifier_character
  "n"
end

Public Instance Methods

max_length() click to toggle source
# File lib/adlint/cc1/format.rb, line 1438
def max_length
  0
end
min_length() click to toggle source
# File lib/adlint/cc1/format.rb, line 1434
def min_length
  0
end
valid_conversion_specifier_character?() click to toggle source
# File lib/adlint/cc1/format.rb, line 1430
def valid_conversion_specifier_character?
  true
end

Private Instance Methods

argument_types() click to toggle source
# File lib/adlint/cc1/format.rb, line 1447
def argument_types
  # NOTE: The ISO C99 standard says;
  #
  # 7.19.6.1 The fprintf function
  #
  # 7 The length modifiers and their meanings are:
  #
  #   hh   Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a signed char or unsigned char argument
  #        (the argument will have been promoted according to the integer
  #        promotions, but its value shall be converted to signed char or
  #        unsigned char before printing); or that a following n
  #        conversion specifier applies to a pointer to a signed char
  #        argument.
  #   h    Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a short int or unsigned short int
  #        argument (the argument will have been promoted according to
  #        the integer promotions, but its value shall be converted to
  #        short int or unsigned short int before printing); or that a
  #        following n conversion specifier applies to a pointer to a
  #        short int argument.
  #   l    Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a long int or unsigned long int argument;
  #        that a following n conversion specifier applies to a pointer
  #        to a long int argument; that a following c conversion
  #        specifier applies to a wint_t argument; that a following s
  #        conversion specifier applies to a pointer to a wchar_t
  #        argument; or has no effect on a following a, A, e, E, f, F, g,
  #        or G conversion specifier.
  #   ll   Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a long long int or unsigned long long int
  #        argument; or that a following n conversion specifier applies
  #        to a pointer to a long long int argument.
  #   j    Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to an intmax_t or uintmax_t argument; or
  #        that a following n conversion specifier applies to a pointer
  #        to an intmax_t argument.
  #   z    Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a size_t or the corresponding signed
  #        integer type argument; or that a following n conversion
  #        specifier applies to a pointer to a signed integer type
  #        corresponding to size_t argument.
  #   t    Specifies that a following d, i, o, u, x, or X conversion
  #        specifier applies to a ptrdiff_t or the corresponding unsigned
  #        integer type argument; or that a following n conversion
  #        specifier applies to a pointer to a ptrdiff_t argument.
  case length_modifier
  when "hh"
    [pointer_type(qualified_type(signed_char_t, :const))]
  when "h"
    [pointer_type(qualified_type(signed_short_t, :const))]
  when "l"
    [pointer_type(qualified_type(signed_long_t, :const))]
  when "ll"
    [pointer_type(qualified_type(signed_long_long_t, :const))]
  when "j"
    # FIXME: `intmax_t' is not supported yet.
    [pointer_type(qualified_type(signed_long_long_t, :const))]
  when "z"
    # FIXME: `size_t' is not supported yet.
    [pointer_type(qualified_type(signed_long_t, :const))]
  when "t"
    # FIXME: `ptrdiff_t' is not supported yet.
    [pointer_type(qualified_type(signed_int_t, :const))]
  else
    [pointer_type(qualified_type(signed_int_t, :const))]
  end
end
default_precision_value() click to toggle source
# File lib/adlint/cc1/format.rb, line 1443
def default_precision_value
  0
end
suitable_length_modifiers() click to toggle source
# File lib/adlint/cc1/format.rb, line 1516
def suitable_length_modifiers
  ["hh", "h", "l", "ll", "j", "z", "t"]
end