class AdLint::Exam::CBuiltin::W0739
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 17995 def initialize(phase_ctxt) super @interp = phase_ctxt[:cc1_interpreter] @interp.on_additive_expr_evaled += T(:check) end
Private Instance Methods
check(expr, lhs_var, rhs_var, rslt_var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18002 def check(expr, lhs_var, rhs_var, rslt_var) return unless expr.operator.type == "-" return unless constant_expression?(expr.lhs_operand) return unless constant_expression?(expr.rhs_operand) return unless lhs_var.type.scalar? && lhs_var.type.unsigned? return unless rhs_var.type.scalar? && rhs_var.type.unsigned? return unless lhs_var.value.scalar? && rhs_var.value.scalar? unbound_val = lhs_var.value - rhs_var.value lower_test = unbound_val < scalar_value_of(rslt_var.type.min) W(expr.location) if lower_test.test_must_be_true.true? end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18019 def interpreter @interp end