class AdLint::Exam::CBuiltin::W0744

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 18201
def initialize(phase_ctxt)
  super
  @interp = phase_ctxt[:cc1_interpreter]
  @interp.on_if_ctrlexpr_evaled      += T(:check_if_statement)
  @interp.on_if_else_ctrlexpr_evaled += T(:check_if_else_statement)
  @interp.on_while_ctrlexpr_evaled   += T(:check_while_statement)
  @interp.on_for_ctrlexpr_evaled     += T(:check_for_statement)
  @interp.on_c99_for_ctrlexpr_evaled += T(:check_c99_for_statement)
end

Private Instance Methods

check_c99_for_statement(c99_for_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18244
def check_c99_for_statement(c99_for_stmt, ctrlexpr_val)
  ctrlexpr = c99_for_stmt.condition_statement.expression
  if constant_expression?(ctrlexpr) &&
      ctrlexpr_val.test_must_be_false.true?
    W(ctrlexpr.location)
  end
end
check_for_statement(for_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18236
def check_for_statement(for_stmt, ctrlexpr_val)
  ctrlexpr = for_stmt.condition_statement.expression
  if constant_expression?(ctrlexpr) &&
      ctrlexpr_val.test_must_be_false.true?
    W(ctrlexpr.location)
  end
end
check_if_else_statement(if_else_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18220
def check_if_else_statement(if_else_stmt, ctrlexpr_val)
  ctrlexpr = if_else_stmt.expression
  if constant_expression?(ctrlexpr) &&
      ctrlexpr_val.test_must_be_false.true?
    W(ctrlexpr.location)
  end
end
check_if_statement(if_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18212
def check_if_statement(if_stmt, ctrlexpr_val)
  ctrlexpr = if_stmt.expression
  if constant_expression?(ctrlexpr) &&
      ctrlexpr_val.test_must_be_false.true?
    W(ctrlexpr.location)
  end
end
check_while_statement(while_stmt, ctrlexpr_val) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18228
def check_while_statement(while_stmt, ctrlexpr_val)
  ctrlexpr = while_stmt.expression
  if constant_expression?(ctrlexpr) &&
      ctrlexpr_val.test_must_be_false.true?
    W(ctrlexpr.location)
  end
end
interpreter() click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 18252
def interpreter
  @interp
end