class AdLint::Exam::CBuiltin::W0055

Public Class Methods

new(phase_ctxt) click to toggle source
Calls superclass method AdLint::Examination::new
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 178
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cpp_interpreter]
  interp.on_object_like_macro_defined      += T(:check)
  interp.on_function_like_macro_defined    += T(:check)
  interp.on_va_function_like_macro_defined += T(:check)
  @macro_num = 0
end

Private Instance Methods

check(define_line, *) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 188
def check(define_line, *)
  unless in_initial_header?(define_line)
    @macro_num += 1
    W(define_line.location) if @macro_num == 1025
  end
end
cinit_fpath() click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 209
def cinit_fpath
  if fpath = traits.of_compiler.initial_header
    Pathname.new(fpath)
  else
    nil
  end
end
in_initial_header?(node) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 195
def in_initial_header?(node)
  node.location.fpath.identical?(pinit_fpath) ||
    node.location.fpath.identical?(cinit_fpath)
end
pinit_fpath() click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 200
def pinit_fpath
  if fpath = traits.of_project.initial_header
    Pathname.new(fpath)
  else
    nil
  end
end