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

Method misra_2_2

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

Source from the content-addressed store, hash-verified

1720 self.reportError(token, 1, 4)
1721
1722 def misra_2_2(self, cfg):
1723 for token in cfg.tokenlist:
1724 if token.isExpandedMacro:
1725 continue
1726 if (token.str in '+-') and token.astOperand2:
1727 if simpleMatch(token.astOperand1, '0'):
1728 self.reportError(token.astOperand1, 2, 2)
1729 elif simpleMatch(token.astOperand2, '0'):
1730 self.reportError(token.astOperand2, 2, 2)
1731 if token.str == '*' and token.astOperand2:
1732 if simpleMatch(token.astOperand2, '0'):
1733 self.reportError(token.astOperand1, 2, 2)
1734 elif simpleMatch(token.astOperand1, '0'):
1735 self.reportError(token.astOperand2, 2, 2)
1736 elif simpleMatch(token.astOperand1, '1'):
1737 self.reportError(token.astOperand1, 2, 2)
1738 elif simpleMatch(token.astOperand2, '1'):
1739 self.reportError(token.astOperand2, 2, 2)
1740
1741 def misra_2_3(self, dumpfile, typedefInfo):
1742 self._save_ctu_summary_typedefs(dumpfile, typedefInfo)

Callers

nothing calls this directly

Calls 2

reportErrorMethod · 0.95
simpleMatchFunction · 0.70

Tested by

no test coverage detected