class AdLint::Cc1::PrintfFormat::CompleteConversionSpecifier

Public Instance Methods

acceptable?() click to toggle source

DESCRIPTION

Checks whether types of arguments match this directive.

RETURN VALUE

Boolean – True if types of arguments match this directive.

# File lib/adlint/cc1/format.rb, line 764
def acceptable?
  if @field_width_argument
    unless @field_width_argument.type.convertible?(signed_int_t) ||
        @field_width_argument.type.convertible?(unsigned_int_t)
      return false
    end
  end

  if @precision_argument
    unless @precision_argument.type.convertible?(signed_int_t) ||
        @precision_argument.type.convertible?(unsigned_int_t)
      return false
    end
  end

  if @conversion_argument
    if argument_types
      argument_types.any? do |arg_type|
        @conversion_argument.type.convertible?(arg_type)
      end
    else
      true
    end
  else
    false
  end
end
complete?() click to toggle source
# File lib/adlint/cc1/format.rb, line 803
def complete?
  true
end
valid_field_width?() click to toggle source
# File lib/adlint/cc1/format.rb, line 811
def valid_field_width?
  true
end
valid_flags?() click to toggle source
# File lib/adlint/cc1/format.rb, line 807
def valid_flags?
  true
end
valid_length_modifier?() click to toggle source
# File lib/adlint/cc1/format.rb, line 819
def valid_length_modifier?
  if length_modifier.empty?
    true
  else
    suitable_length_modifiers.include?(length_modifier)
  end
end
valid_precision?() click to toggle source
# File lib/adlint/cc1/format.rb, line 815
def valid_precision?
  true
end
wellformed?() click to toggle source

DESCRIPTION

Checks whether the format string of this directive is the ISO C99 compliant.

RETURN VALUE

Boolean – True if the format string is wellformed.

# File lib/adlint/cc1/format.rb, line 798
def wellformed?
  valid_flags? && valid_field_width? && valid_precision? &&
    valid_length_modifier? && valid_conversion_specifier_character?
end

Private Instance Methods

argument_types() click to toggle source
# File lib/adlint/cc1/format.rb, line 828
def argument_types
  subclass_responsibility
end
suitable_length_modifiers() click to toggle source
# File lib/adlint/cc1/format.rb, line 832
def suitable_length_modifiers
  subclass_responsibility
end