Leftright-check
Check for strange expressions like A [op] A.
This is a heuristic for generating warnings, inspired by PVS
Studio. It has found a few pretty minor things that we were able to clean up,
and also found one interesting copy/paste bug.
We look for identical sub-expressions on the left and right of most binary
operations, for instance A | A and A == A. It is usually pretty
strange to write such an expression, and sometimes these indicate copy/paste
errors. We do similar checking for the then- and else-branches of ?:
operators.
We also look for part-selects that use the same expressions for both
indices, e.g., foo[3:3], but these are somewhat more common and minor, and
sometimes result from macros or parameterized modules, so we generally think
these are pretty minor and uninteresting.
Subtopics
- Vl-modulelist-leftright-check
- (vl-modulelist-leftright-check x) maps vl-module-leftright-check across a list.
- Vl-expr-leftright-check
- Search for strange expressions like A [op] A.
- Vl-leftright-exprlist-duplicates
- Optimized duplicate expression gatherer for leftright checking.
- Vl-collect-ac-args
- Collect the nested arguments to an associative/commutative operator.
- Vl-module-leftright-check
- (vl-module-leftright-check x) carries our our leftright-check on all the expressions in a module, and adds any resulting
warnings to the module.
- Vl-exprctxalist-leftright-check
- (vl-exprctxalist-leftright-check x) extends vl-expr-leftright-check across an vl-exprctxalist-p.
- Vl-expr-indexy-via-ctx
- Vl-design-leftright-check
- Vl-op-ac-p
- Recognizes the associative/commutative binary vl-op-ps.