class AdLint::Exam::CBuiltin::W0482

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 765
def initialize(phase_ctxt)
  super
  trav = phase_ctxt[:cpp_ast_traversal]
  trav.enter_object_like_define_line += T(:check)
end

Private Instance Methods

check(node) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 772
def check(node)
  if repl_list = node.replacement_list
    return unless repl_list.tokens.size == 1
    if type_specifier?(repl_list.tokens.first)
      W(node.location)
    end
  end
end
type_specifier?(pp_tok) click to toggle source
# File lib/adlint/exam/c_builtin/cpp_check.rb, line 781
def type_specifier?(pp_tok)
  case pp_tok.value
  when "void", "char", "short", "int", "long", "float", "double"
    true
  when "signed", "unsigned"
    true
  when "struct", "union", "enum"
    true
  else
    false
  end
end