class AdLint::Exam::CBuiltin::W0796

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 19787
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 19794
def check(funcall_expr, fun, arg_vars, *)
  if proto = prototype_declaration_of(fun)
    return if proto.type.have_va_list?

    param_types = proto.type.parameter_types
    if !param_types.empty? &&
        arg_vars.size > param_types.select { |type| !type.void? }.size
      W(funcall_expr.location)
    end
  end
end
prototype_declaration_of(fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19806
def prototype_declaration_of(fun)
  fun.declarations_and_definitions.find do |dcl_or_def|
    dcl_or_def.kind_of?(Cc1::FunctionDeclaration)
  end
end