class AdLint::Cc1::ScanfFormat::Conversion_n
Public Class Methods
new(fmt, trailing_args, env, as_char, field_width, len_mod, cs_char, scanset)
click to toggle source
Calls superclass method
AdLint::Cc1::ScanfFormat::ConversionSpecifier::new
# File lib/adlint/cc1/format.rb, line 2903 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 2899 def self.suitable_conversion_specifier_character "n" end
Public Instance Methods
valid_assignment_suppressing_character?()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2909 def valid_assignment_suppressing_character? # NOTE: The ISO C99 standard says; # # 7.19.6.2 The fscanf function # # 12 The conversion specifiers and their meanings are: # # n No input is consumed. The corresponding argument shall be # a pointer to signed integer into which is to be written # the number of characters read from the input stream so far # by this call to the fscanf function. Execution of a %n # directive does not increment the assignment count returned # at the completion of execution of the fscanf function. No # argument is converted, but one is consumed. If the # conversion specification includes an # assignment-suppressing character or a field width, the # behavior is undefined. assignment_suppressing_character.empty? end
valid_conversion_specifier_character?()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2933 def valid_conversion_specifier_character? true end
valid_field_width?()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2929 def valid_field_width? field_width.empty? end
valid_scanset?()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2937 def valid_scanset? true end
Private Instance Methods
argument_types()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2942 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 [pointer_type(signed_int_t)] end end
suitable_length_modifiers()
click to toggle source
# File lib/adlint/cc1/format.rb, line 2998 def suitable_length_modifiers ["hh", "h", "l", "ll", "j", "z", "t"] end