class AdLint::Exam::CBuiltin::W0720
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 17422 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 17429 def check(expr, orig_var, rslt_var) orig_type = orig_var.type rslt_type = rslt_var.type unless orig_type.scalar? && orig_type.floating? && rslt_type.scalar? && rslt_type.integer? return end orig_val = orig_var.value return unless orig_val.scalar? lower_bound = scalar_value_of(rslt_type.min - 1) test = orig_val.test_must_be_less_than(lower_bound) if test.true? W(expr.location, *test.evidence.emit_context_messages(self, expr.location)) return end upper_bound = scalar_value_of(rslt_type.max + 1) test = orig_val.test_must_be_greater_than(upper_bound) if test.true? W(expr.location, *test.evidence.emit_context_messages(self, expr.location)) end end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 17457 def interpreter @interp end