class AdLint::Exam::CBuiltin::W0118
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 3113 def initialize(phase_ctxt) super interp = phase_ctxt[:cc1_interpreter] fst_src = phase_ctxt[:sources].first if fst_src && fst_src.analysis_target?(traits) interp.on_explicit_function_declared += M(:check_function) interp.on_variable_declared += M(:check_variable) @target_fpath = fst_src.fpath @external_syms = Set.new end end
Private Instance Methods
check_function(fun_dcl, fun)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 3126 def check_function(fun_dcl, fun) if fun.named? && fun.declared_as_extern? unless @external_syms.include?(fun.name) if fun_dcl.location.fpath.identical?(@target_fpath) W(fun_dcl.location, fun.name) else @external_syms.add(fun.name) end end end end
check_variable(var_dcl, var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 3138 def check_variable(var_dcl, var) if var.named? && var.declared_as_extern? unless @external_syms.include?(var.name) if var_dcl.location.fpath.identical?(@target_fpath) W(var_dcl.location, var.name) else @external_syms.add(var.name) end end end end