class AdLint::Exam::CBuiltin::W0040

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 1013
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)
end

Private Instance Methods

check(node) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 1021
def check(node)
  node.struct_declarations.each do |struct_dcl|
    struct_dcl.items.each do |memb_dcl|
      memb_type = memb_dcl.type
      next unless memb_type.scalar? && memb_type.integer?
      if memb_type.bitfield? && !memb_type.explicitly_signed?
        W(node.location)
        return
      end
    end
  end
end