class AdLint::Exam::CBuiltin::W0036

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 794
def initialize(phase_ctxt)
  super
  trav = phase_ctxt[:cc1_ast_traversal]
  trav.enter_init_declarator           += T(:check_init_dcr)
  trav.enter_struct_declarator         += T(:check_struct_dcr)
  trav.enter_parameter_declaration     += T(:check_parameter_dcl)
  trav.enter_kandr_function_definition += T(:check_kandr_fundef)
  trav.enter_ansi_function_definition  += T(:check_ansi_fundef)
  trav.enter_type_name                 += T(:check_type_name)
end

Private Instance Methods

check_ansi_fundef(fun_def) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 836
def check_ansi_fundef(fun_def)
  dcr_num = DeclaratorCounter.new.tap { |cnt|
    fun_def.declarator.accept(cnt)
  }.result

  W(fun_def.location) if dcr_num > 12
end
check_init_dcr(init_dcr) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 806
def check_init_dcr(init_dcr)
  dcr_num = DeclaratorCounter.new.tap { |cnt|
    init_dcr.declarator.accept(cnt)
  }.result

  W(init_dcr.location) if dcr_num > 12
end
check_kandr_fundef(fun_def) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 828
def check_kandr_fundef(fun_def)
  dcr_num = DeclaratorCounter.new.tap { |cnt|
    fun_def.declarator.accept(cnt)
  }.result

  W(fun_def.location) if dcr_num > 12
end
check_parameter_dcl(param_dcl) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 821
def check_parameter_dcl(param_dcl)
  if dcr = param_dcl.declarator
    dcr_num = DeclaratorCounter.new.tap { |cnt| dcr.accept(cnt) }.result
    W(param_dcl.location) if dcr_num > 12
  end
end
check_struct_dcr(struct_dcr) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 814
def check_struct_dcr(struct_dcr)
  if dcr = struct_dcr.declarator
    dcr_num = DeclaratorCounter.new.tap { |cnt| dcr.accept(cnt) }.result
    W(struct_dcr.location) if dcr_num > 12
  end
end
check_type_name(type_name) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 844
def check_type_name(type_name)
  if dcr = type_name.abstract_declarator
    dcr_num = DeclaratorCounter.new.tap { |cnt| dcr.accept(cnt) }.result
    W(type_name.location) if dcr_num > 12
  end
end