class AdLint::Exam::CBuiltin::W0556

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 12768
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_function_started          += T(:enter_function)
  interp.on_function_ended            += T(:leave_function)
  interp.on_function_call_expr_evaled += T(:check)
  @functions = []
end

Private Instance Methods

check(funcall_expr, fun, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12786
def check(funcall_expr, fun, *)
  if cur_fun = @functions.last and fun == cur_fun
    W(funcall_expr.location)
  end
end
enter_function(*, fun) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12778
def enter_function(*, fun)
  @functions.push(fun)
end
leave_function(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12782
def leave_function(*)
  @functions.pop
end