class AdLint::Exam::CBuiltin::W0082

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 1873
def initialize(phase_ctxt)
  super
  @interp = phase_ctxt[:cc1_interpreter]
  @interp.on_unary_arithmetic_expr_evaled += T(:check)
end

Private Instance Methods

check(expr, ope_var, *) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 1880
def check(expr, ope_var, *)
  if expr.operator.type == "-"
    if unsigned_underlying_type?(ope_var.type)
      W(expr.location, ope_var.type.brief_image)
    end
  end
end
interpreter() click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 1893
def interpreter
  @interp
end
unsigned_underlying_type?(type) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 1888
def unsigned_underlying_type?(type)
  type.same_as?(unsigned_char_t) ||
    type.same_as?(unsigned_short_t) || type.bitfield?
end