class AdLint::Exam::CBuiltin::W0793

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 19696
def initialize(phase_ctxt)
  super
  interp = phase_ctxt[:cc1_interpreter]
  interp.on_explicit_conv_performed += T(:check)
end

Private Instance Methods

check(expr, orig_var, rslt_var) click to toggle source
# File lib/adlint/exam/c_builtin/cc1_check.rb, line 19703
def check(expr, orig_var, rslt_var)
  lhs_type = orig_var.type.unqualify
  rhs_type = rslt_var.type.unqualify

  if lhs_type.pointer? && rhs_type.pointer?
    case
    when lhs_type.base_type.void? || rhs_type.base_type.void?
      # NOTE: Nothing to be done with conversion between `void *' and any
      #       pointer and between `void *' and `void *'.
    when lhs_type.base_type.function? && !rhs_type.base_type.function?,
         rhs_type.base_type.function? && !lhs_type.base_type.function?
      W(expr.location)
    end
  end
end