class AdLint::Exam::CBuiltin::W0785

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 19273
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_struct_declared += T(:check)
  interp.on_union_declared  += T(:check)
  interp.on_enum_declared   += T(:check)
  @tag_names = Set.new
end

Private Instance Methods

check(type_dcl) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19283
def check(type_dcl)
  # NOTE: Unique autogenerated tag name is assigned to the unnamed
  #       struct/union/enum declarations in parsing phase.
  tag_name = type_dcl.identifier.value

  W(type_dcl.location, tag_name) if @tag_names.include?(tag_name)
  @tag_names.add(tag_name)
end