class AdLint::Exam::CBuiltin::W0566

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 13092
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_explicit_conv_performed += T(:check)
end

Private Instance Methods

check(expr, orig_var, rslt_var) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13099
def check(expr, orig_var, rslt_var)
  lhs_type = orig_var.type.unqualify
  rhs_type = rslt_var.type.unqualify

  case
  when lhs_type.integer? && !lhs_type.pointer? &&
       rhs_type.pointer? && rhs_type.base_type.function?
    W(expr.location)
  when rhs_type.integer? && !rhs_type.pointer? &&
       lhs_type.pointer? && lhs_type.base_type.function?
    W(expr.location)
  end
end