MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / misra_10_7

Method misra_10_7

addons/misra.py:2597–2623  ·  view source on GitHub ↗
(self, cfg)

Source from the content-addressed store, hash-verified

2595 pass
2596
2597 def misra_10_7(self, cfg):
2598 for token in cfg.tokenlist:
2599 if token.astOperand1 is None or token.astOperand2 is None:
2600 continue
2601 if not token.isArithmeticalOp:
2602 continue
2603 if not is_composite_expr(token):
2604 continue
2605 parent = token.astParent
2606 if parent is None:
2607 continue
2608 if not parent.isArithmeticalOp:
2609 if not parent.isAssignmentOp:
2610 continue
2611 if parent.str == '=':
2612 continue
2613 token_type = getEssentialType(token)
2614 if token_type is None:
2615 continue
2616 sibling = parent.astOperand1 if (token == parent.astOperand2) else parent.astOperand2
2617 sibling_type = getEssentialType(sibling)
2618 if sibling_type is None:
2619 continue
2620 b1 = bitsOfEssentialType(token_type)
2621 b2 = bitsOfEssentialType(sibling_type)
2622 if b1 > 0 and b1 < b2:
2623 self.reportError(token, 10, 7)
2624
2625 def misra_10_8(self, data):
2626 for token in data.tokenlist:

Callers

nothing calls this directly

Calls 4

reportErrorMethod · 0.95
is_composite_exprFunction · 0.85
getEssentialTypeFunction · 0.85
bitsOfEssentialTypeFunction · 0.85

Tested by

no test coverage detected