From 6c0f4f46cecb07f1521fdf05f3cb42dbabb42126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 16 Apr 2017 11:01:49 +0200 Subject: [PATCH] Misra: Harden rule 11.7 --- addons/misra.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/misra.py b/addons/misra.py index 952ca5e24..5bb272557 100644 --- a/addons/misra.py +++ b/addons/misra.py @@ -270,11 +270,11 @@ def misra_11_7(data): for token in data.tokenlist: if not isCast(token): continue - if not token.valueType or not token.astOperand1.valueType: + vt1 = token.valueType + vt2 = token.astOperand1.valueType + if not vt1 or not vt2: continue - if token.valueType.pointer==0 or token.valueType.pointer==0: - continue - if token.valueType.type == 'record' and token.valueType.type == 'record': + if vt1.pointer>0 and vt1.type=='record' and vt2.pointer>0 and vt2.type=='record' and vt1.typeScopeId != vt2.typeScopeId: reportError(token, 11, 7) def misra_11_8(data):