class AdLint::Exam::CBuiltin::W0424
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 8585 def initialize(phase_ctxt) super interp = phase_ctxt[:cc1_interpreter] interp.on_multiplicative_expr_evaled += T(:check_binary) interp.on_additive_expr_evaled += T(:check_binary) interp.on_shift_expr_evaled += T(:check_binary) interp.on_and_expr_evaled += T(:check_binary) interp.on_exclusive_or_expr_evaled += T(:check_binary) interp.on_inclusive_or_expr_evaled += T(:check_binary) interp.on_prefix_increment_expr_evaled += T(:check_unary_prefix) interp.on_postfix_increment_expr_evaled += T(:check_unary_postfix) interp.on_prefix_decrement_expr_evaled += T(:check_unary_prefix) interp.on_postfix_decrement_expr_evaled += T(:check_unary_postfix) end
Private Instance Methods
check_binary(expr, lhs_var, rhs_var, *)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 8601 def check_binary(expr, lhs_var, rhs_var, *) lhs_type, lhs_val = lhs_var.type, lhs_var.value rhs_type, rhs_val = rhs_var.type, rhs_var.value if lhs_type.pointer? && lhs_val.test_must_be_null.false? test = lhs_val.test_may_be_null if test.true? lhs_operand = expr.lhs_operand W(lhs_operand.location, *test.evidence.emit_context_messages(self, lhs_operand.location)) end end if rhs_type.pointer? && rhs_val.test_must_be_null.false? test = rhs_val.test_may_be_null if test.true? rhs_operand = expr.rhs_operand W(rhs_operand.location, *test.evidence.emit_context_messages(self, rhs_operand.location)) end end end
check_unary_postfix(expr, ope_var, *)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 8636 def check_unary_postfix(expr, ope_var, *) type, val = ope_var.type, ope_var.value if type.pointer? && val.test_must_be_null.false? test = val.test_may_be_null if test.true? W(expr.operand.location, *test.evidence.emit_context_messages(self, expr.operand.location)) end end end
check_unary_prefix(expr, ope_var, orig_val)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 8624 def check_unary_prefix(expr, ope_var, orig_val) type, val = ope_var.type, orig_val if type.pointer? && val.test_must_be_null.false? test = val.test_may_be_null if test.true? W(expr.operand.location, *test.evidence.emit_context_messages(self, expr.operand.location)) end end end