class AdLint::Exam::CBuiltin::W0700

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 16134
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_function_started       += T(:start_function)
  interp.on_function_ended         += T(:end_function)
  interp.on_return_stmt_evaled     += T(:check_explicit_return)
  interp.on_implicit_return_evaled += M(:check_implicit_return)
  @cur_fun = nil
end

Private Instance Methods

check_explicit_return(ret_stmt, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 16153
def check_explicit_return(ret_stmt, *)
  if @cur_fun
    if @cur_fun.implicitly_typed? && ret_stmt.expression.nil?
      W(@cur_fun.location, @cur_fun.identifier.value)
    end
  end
end
check_implicit_return(loc) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 16161
def check_implicit_return(loc)
  if @cur_fun && loc.in_analysis_target?(traits)
    if @cur_fun.implicitly_typed?
      W(@cur_fun.location, @cur_fun.identifier.value)
    end
  end
end
end_function(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 16149
def end_function(*)
  @cur_fun = nil
end
start_function(fun_def, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 16145
def start_function(fun_def, *)
  @cur_fun = fun_def
end