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

Method misra_11_5

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

Source from the content-addressed store, hash-verified

2755 self.reportError(token, 11, 4)
2756
2757 def misra_11_5(self, data):
2758 for token in data.tokenlist:
2759 if not isCast(token):
2760 if token.astOperand1 and token.astOperand2 and token.str == "=" and token.next.str != "(":
2761 vt1 = token.astOperand1.valueType
2762 vt2 = token.astOperand2.valueType
2763 if not vt1 or not vt2:
2764 continue
2765 if vt1.pointer > 0 and vt1.type != 'void' and vt2.pointer == vt1.pointer and vt2.type == 'void':
2766 self.reportError(token, 11, 5)
2767 continue
2768 if token.astOperand1.astOperand1 and token.astOperand1.astOperand1.str in (
2769 'malloc', 'calloc', 'realloc', 'free'):
2770 continue
2771 vt1 = token.valueType
2772 vt2 = token.astOperand1.valueType
2773 if not vt1 or not vt2:
2774 continue
2775 if vt1.pointer > 0 and vt1.type != 'void' and vt2.pointer == vt1.pointer and vt2.type == 'void':
2776 self.reportError(token, 11, 5)
2777
2778 def misra_11_6(self, data):
2779 for token in data.tokenlist:

Callers

nothing calls this directly

Calls 2

reportErrorMethod · 0.95
isCastFunction · 0.70

Tested by

no test coverage detected