class AdLint::Exam::CBuiltin::W0597
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 13926 def initialize(phase_ctxt) super interp = phase_ctxt[:cc1_interpreter] interp.on_sequence_point_reached += T(:commit_changes) interp.on_variable_value_updated += T(:update_variable) @update_cnt = Hash.new(0) end
Private Instance Methods
commit_changes(seqp)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13935 def commit_changes(seqp) @update_cnt.each { |var, cnt| W(seqp.location, var.name) if cnt > 1 } @update_cnt = Hash.new(0) end
update_variable(*, var)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13940 def update_variable(*, var) @update_cnt[var] += 1 if var.named? end