class AdLint::Exam::CBuiltin::W0738
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 17946 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 17953 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.unsigned? return end orig_val = orig_var.value return unless orig_val.scalar? upper_test = orig_val > scalar_value_of(rslt_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 17981 def interpreter @interp end