class AdLint::Exam::CBuiltin::W0030
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 601 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 617 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 constant_expression?(expr.lhs_operand) && lhs_type.pointer? && lhs_val.test_must_be_null.true? W(expr.lhs_operand.location) end if constant_expression?(expr.rhs_operand) && rhs_type.pointer? && rhs_val.test_must_be_null.true? W(expr.rhs_operand.location) end end
check_unary_postfix(expr, ope_var, *)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 641 def check_unary_postfix(expr, ope_var, *) type, val = ope_var.type, ope_var.value if constant_expression?(expr.operand) && type.pointer? && val.test_must_be_null.true? W(expr.operand.location) end end
check_unary_prefix(expr, ope_var, orig_val)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 632 def check_unary_prefix(expr, ope_var, orig_val) type, val = ope_var.type, orig_val if constant_expression?(expr.operand) && type.pointer? && val.test_must_be_null.true? W(expr.operand.location) end end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 650 def interpreter @interp end