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

Method misra_11_3

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

Source from the content-addressed store, hash-verified

2699 self.reportError(token, 11, 2)
2700
2701 def misra_11_3(self, data):
2702 for token in data.tokenlist:
2703 if not isCast(token):
2704 continue
2705 vt1 = token.valueType
2706 vt2 = token.astOperand1.valueType
2707 if not vt1 or not vt2:
2708 continue
2709 if vt1.type == 'void' or vt2.type == 'void':
2710 continue
2711 if (vt1.pointer > 0 and vt1.type == 'record' and
2712 vt2.pointer > 0 and vt2.type == 'record' and
2713 vt1.typeScopeId != vt2.typeScopeId):
2714 self.reportError(token, 11, 3)
2715 elif (vt1.pointer == vt2.pointer and vt1.pointer > 0 and
2716 vt1.type != vt2.type and vt1.type != 'char'):
2717 self.reportError(token, 11, 3)
2718
2719 def misra_11_4(self, data):
2720 # Get list of macro definitions

Callers

nothing calls this directly

Calls 2

reportErrorMethod · 0.95
isCastFunction · 0.70

Tested by

no test coverage detected