class AdLint::Exam::CBuiltin::W0741
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 18071 def initialize(phase_ctxt) super @interp = phase_ctxt[:cc1_interpreter] @interp.on_multiplicative_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 18078 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 upper_test = unbound_val > scalar_value_of(rslt_var.type.max) W(expr.location) if upper_test.test_must_be_true.true? end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18095 def interpreter @interp end