class AdLint::Exam::CBuiltin::W1030
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 20567 def initialize(phase_ctxt) super trav = phase_ctxt[:cc1_ast_traversal] trav.enter_generic_labeled_statement += T(:check) trav.enter_ansi_function_definition += T(:enter_function) trav.leave_ansi_function_definition += T(:leave_function) trav.enter_kandr_function_definition += T(:enter_function) trav.leave_kandr_function_definition += T(:leave_function) @labels = nil end
Private Instance Methods
check(labeled_stmt)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20579 def check(labeled_stmt) if @labels if @labels.include?(labeled_stmt.label.value) W(labeled_stmt.label.location, labeled_stmt.label.value) else @labels.add(labeled_stmt.label.value) end end end
enter_function(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20589 def enter_function(*) @labels = Set.new end
leave_function(*)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 20593 def leave_function(*) @labels = nil end