class AdLint::Exam::CBuiltin::W0721

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 17469
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 17476
def check(expr, orig_var, rslt_var)
  orig_type = orig_var.type
  rslt_type = rslt_var.type

  unless orig_type.pointer? && rslt_type.scalar? && rslt_type.integer?
    return
  end

  if orig_type.min < rslt_type.min || orig_type.max > rslt_type.max
    W(expr.location)
  end
end