class AdLint::Exam::CBuiltin::W0584
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 13770 def initialize(phase_ctxt) super @interp = phase_ctxt[:cc1_interpreter] @interp.on_function_call_expr_evaled += T(:check) end
Private Instance Methods
check(funcall_expr, fun, arg_vars, *)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13777 def check(funcall_expr, fun, arg_vars, *) return unless fun.named? return unless kandr_style_definition_of(fun) return if fun.type.have_va_list? args = arg_vars.map { |var| [var.type, var.value.to_single_value] } param_types = fun.type.parameter_types.reject { |type| type.void? } return unless args.size == param_types.size args.zip(param_types).each_with_index do |(arg, ptype), idx| arg_expr = funcall_expr.argument_expressions[idx] if constant_expression?(arg_expr) next if untyped_pointer_conversion?(arg.first, ptype, arg.last) end unless arg.first.convertible?(ptype) W(arg_expr.location, idx + 1) end end end
interpreter()
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13805 def interpreter @interp end
kandr_style_definition_of(fun)
click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 13799 def kandr_style_definition_of(fun) fun.declarations_and_definitions.find do |dcl_or_def| dcl_or_def.kind_of?(Cc1::KandRFunctionDefinition) end end