class AdLint::Exam::CBuiltin::W0544
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 12556 def initialize(phase_ctxt) super interp = phase_ctxt[:cc1_interpreter] interp.on_variable_initialized += T(:check_initialization) interp.on_assignment_expr_evaled += T(:check_assignment) end
Private Instance Methods
check(node, lhs_fun_type, rhs_fun_type)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12584 def check(node, lhs_fun_type, rhs_fun_type) param_types = lhs_fun_type.parameter_types.zip(rhs_fun_type.parameter_types) if param_types.any? { |l, r| l && r && l.param_name != r.param_name } W(node.location) end end
check_assignment(expr, lhs_var, rhs_var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12574 def check_assignment(expr, lhs_var, rhs_var) lhs_type = lhs_var.type.unqualify rhs_type = rhs_var.type.unqualify if lhs_type.pointer? && lhs_type.base_type.function? && rhs_type.pointer? && rhs_type.base_type.function? check(expr, lhs_type.base_type, rhs_type.base_type) end end
check_initialization(var_def, var, init_var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 12564 def check_initialization(var_def, var, init_var) lhs_type = var.type.unqualify rhs_type = init_var.type.unqualify if lhs_type.pointer? && lhs_type.base_type.function? && rhs_type.pointer? && rhs_type.base_type.function? check(var_def, lhs_type.base_type, rhs_type.base_type) end end