class AdLint::Exam::CBuiltin::W0797

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Examination::new
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19820
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_function_call_expr_evaled += T(:check)
end

Private Instance Methods

check(funcall_expr, fun, arg_vars, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19827
def check(funcall_expr, fun, arg_vars, *)
  unless prototype_declaration_of(fun)
    if fun_def = kandr_style_definition_of(fun)
      case fun_dcr = fun_def.function_declarator
      when Cc1::KandRFunctionDeclarator
        param_num = fun_dcr.identifier_list.size
      else
        return
      end

      W(funcall_expr.location) unless arg_vars.size == param_num
    end
  end
end
kandr_style_definition_of(fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19848
def kandr_style_definition_of(fun)
  fun.declarations_and_definitions.find do |dcl_or_def|
    dcl_or_def.kind_of?(Cc1::KandRFunctionDefinition)
  end
end
prototype_declaration_of(fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19842
def prototype_declaration_of(fun)
  fun.declarations_and_definitions.find do |dcl_or_def|
    dcl_or_def.kind_of?(Cc1::FunctionDeclaration)
  end
end