class AdLint::Exam::CBuiltin::W0613

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 14485
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_if_ctrlexpr_evaled      += T(:check_if_stmt)
  interp.on_if_else_ctrlexpr_evaled += T(:check_if_else_stmt)
  interp.on_while_ctrlexpr_evaled   += T(:check_while_stmt)
  interp.on_for_ctrlexpr_evaled     += T(:check_for_stmt)
  interp.on_c99_for_ctrlexpr_evaled += T(:check_c99_for_stmt)
end

Private Instance Methods

check_c99_for_stmt(c99_for_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14522
def check_c99_for_stmt(c99_for_stmt, ctrlexpr_val)
  # NOTE: This method is called only if the c99-for-statement has a
  #       controlling expression.
  if ctrlexpr_val.test_must_be_false.true?
    W(c99_for_stmt.condition_statement.expression.location)
  end
end
check_for_stmt(for_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14514
def check_for_stmt(for_stmt, ctrlexpr_val)
  # NOTE: This method is called only if the for-statement has a controlling
  #       expression.
  if ctrlexpr_val.test_must_be_false.true?
    W(for_stmt.condition_statement.expression.location)
  end
end
check_if_else_stmt(if_else_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14502
def check_if_else_stmt(if_else_stmt, ctrlexpr_val)
  if ctrlexpr_val.test_must_be_false.true?
    W(if_else_stmt.expression.location)
  end
end
check_if_stmt(if_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14496
def check_if_stmt(if_stmt, ctrlexpr_val)
  if ctrlexpr_val.test_must_be_false.true?
    W(if_stmt.expression.location)
  end
end
check_while_stmt(while_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 14508
def check_while_stmt(while_stmt, ctrlexpr_val)
  if ctrlexpr_val.test_must_be_false.true?
    W(while_stmt.expression.location)
  end
end