class AdLint::Exam::CBuiltin::W0786

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 19302
def initialize(phase_ctxt)
  super
  trav = phase_ctxt[:cc1_ast_traversal]
  trav.enter_struct_type_declaration += T(:check)
  trav.enter_union_type_declaration  += T(:check)
  @interp = phase_ctxt[:cc1_interpreter]
end

Private Instance Methods

check(node) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19311
def check(node)
  node.struct_declarations.each do |struct_dcl|
    struct_dcl.items.each do |memb_dcl|
      type = memb_dcl.type
      next unless type.scalar? && type.integer? && type.bitfield?

      unless type.base_type.same_as?(int_t) ||
          type.base_type.same_as?(unsigned_int_t) ||
          type.base_type.same_as?(signed_int_t)
        W(node.location)
        return
      end
    end
  end
end
interpreter() click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19327
def interpreter
  @interp
end