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

Method misra_12_2

addons/misra.py:2894–2910  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

2892 continue
2893
2894 def misra_12_2(self, data):
2895 for token in data.tokenlist:
2896 if not (token.str in ('<<', '>>')):
2897 continue
2898 if (not token.astOperand2) or (not token.astOperand2.values):
2899 continue
2900 maxval = 0
2901 for val in token.astOperand2.values:
2902 if val.intvalue and val.intvalue > maxval:
2903 maxval = val.intvalue
2904 if maxval == 0:
2905 continue
2906 sz = bitsOfEssentialType(getEssentialType(token.astOperand1))
2907 if sz <= 0:
2908 continue
2909 if maxval >= sz:
2910 self.reportError(token, 12, 2)
2911
2912 def misra_12_3(self, data):
2913 for token in data.tokenlist:

Callers

nothing calls this directly

Calls 3

reportErrorMethod · 0.95
bitsOfEssentialTypeFunction · 0.85
getEssentialTypeFunction · 0.85

Tested by

no test coverage detected