Check the top-level of a binary expression for precedence problems.
(vl-warn-odd-binary-expression-main op1 a x flipped ss) → *
Note that any particular binary expression, say
The first argument, A, we regard as the "simple" argument; we don't try to
decompose it any more. However, we try to match X against
Function:
(defun vl-warn-odd-binary-expression-main (op1 a x flipped ss) (declare (xargs :guard (and (vl-op-p op1) (vl-expr-p a) (vl-expr-p x) (booleanp flipped) (vl-scopestack-p ss)))) (declare (ignorable a flipped)) (let ((__function__ 'vl-warn-odd-binary-expression-main)) (declare (ignorable __function__)) (b* (((when (or (vl-fast-atom-p x) (not (eql (vl-op-arity (vl-nonatom->op x)) 2)))) nil) (op2 (vl-nonatom->op x)) (op1-class (vl-odd-binop-class op1)) (op2-class (vl-odd-binop-class op2)) (key (cons op1-class op2-class)) (look (assoc-equal key *vl-odd-binops-table*)) ((unless look) nil)) (case (cdr look) ((:check-precedence) (if (assoc-equal "VL_EXPLICIT_PARENS" (vl-nonatom->atts x)) nil :check-precedence)) (:check-type (if (assoc-equal "VL_EXPLICIT_PARENS" (vl-nonatom->atts x)) nil :check-type)) (:check-type-unless-topargs-boolean (b* (((when (assoc-equal "VL_EXPLICIT_PARENS" (vl-nonatom->atts x))) nil) (asize (vl-expr-probable-selfsize a ss)) (xsize (vl-expr-probable-selfsize x ss)) ((when (and (or (not asize) (eql asize 1)) (or (not xsize) (eql xsize 1)))) nil)) :check-type)) ((:check-precedence-plusminus) (if (and flipped (not (assoc-equal "VL_EXPLICIT_PARENS" (vl-nonatom->atts x)))) :check-precedence nil)) (nil nil) (otherwise (raise "Unexpected action type ~x0.~%" (cdr look)))))))