class AdLint::Exam::CBuiltin::W0575

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 982
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cpp_interpreter]
  interp.on_pp_token_extracted             += T(:check_pp_token)
  interp.on_object_like_macro_defined      += T(:check_macro)
  interp.on_function_like_macro_defined    += T(:check_macro)
  interp.on_va_function_like_macro_defined += T(:check_macro)
end

Private Instance Methods

check_macro(*, macro) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 1000
def check_macro(*, macro)
  if repl_list = macro.replacement_list
    repl_list.tokens.each { |pp_tok| check_pp_token(pp_tok) }
  end
end
check_pp_token(pp_tok) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 992
def check_pp_token(pp_tok)
  if pp_tok.value =~ /\AL?"(.*)"\z/
    unless Cpp::BasicSourceCharacterSet.include?($1)
      W(pp_tok.location)
    end
  end
end