class AdLint::Exam::CBuiltin::W1063
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 21401 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) @cur_fun = nil end
Private Instance Methods
check(ret_stmt, ret_var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 21419 def check(ret_stmt, ret_var) return unless @cur_fun && ret_var if ret_type = @cur_fun.type.return_type and ret_type.enum? unless constant_expression?(ret_stmt.expression) unless ret_var.type.same_as?(ret_type) W(ret_stmt.expression.location) end end end end
end_function(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 21415 def end_function(*) @cur_fun = nil end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 21431 def interpreter @interp end
start_function(*, fun)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 21411 def start_function(*, fun) @cur_fun = fun end