class AdLint::Exam::CBuiltin::W1034

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 20737
def initialize(phase_ctxt)
  super
  trav = phase_ctxt[:cc1_ast_traversal]
  trav.enter_function_declaration += T(:check)
  trav.enter_compound_statement   += T(:enter_block)
  trav.leave_compound_statement   += T(:leave_block)
  @block_level = 0
end

Private Instance Methods

check(dcl) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20747
def check(dcl)
  if @block_level > 0
    if sc_spec = dcl.storage_class_specifier and sc_spec.type == :STATIC
      W(dcl.location, dcl.identifier.value)
    end
  end
end
enter_block(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20755
def enter_block(*)
  @block_level += 1
end
leave_block(*) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20759
def leave_block(*)
  @block_level -= 1
end