class AdLint::Exam::CBuiltin::W0743
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 18148 def initialize(phase_ctxt) super @interp = phase_ctxt[:cc1_interpreter] @interp.on_implicit_conv_performed += T(:check) end
Private Instance Methods
check(init_or_expr, orig_var, rslt_var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18155 def check(init_or_expr, orig_var, rslt_var) case init_or_expr when Cc1::Initializer unless expr = init_or_expr.expression return end when Cc1::Expression expr = init_or_expr end return unless constant_expression?(expr) orig_type = orig_var.type rslt_type = rslt_var.type unless orig_type.scalar? && orig_type.integer? && rslt_type.scalar? && rslt_type.integer? && rslt_type.signed? return end orig_val = orig_var.value return unless orig_val.scalar? lower_test = orig_val < scalar_value_of(rslt_type.min) upper_test = orig_val > scalar_value_of(rslt_type.max) if lower_test.test_must_be_true.true? || upper_test.test_must_be_true.true? W(expr.location) end end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18187 def interpreter @interp end