diff --git a/addons/misra.py b/addons/misra.py index 276ba73a374..ae3cf59c8bc 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -2581,8 +2581,6 @@ def misra_11_6(self, data): for token in data.tokenlist: if not isCast(token): continue - if token.astOperand1.astOperand1: - continue vt1 = token.valueType vt2 = token.astOperand1.valueType if not vt1 or not vt2: diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 7511e09f38d..d1ece87f2b2 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -836,10 +836,17 @@ static void misra_11_5(void *p) { p16 = p; // 11.5 } +static intptr_t get_intptr_constant(void) { return 456; } static void misra_11_6(void) { void *p; + struct { + int i; + } s = { .i = 7 }; p = (void*)123; // 11.6 x = (u64)p; // 11.6 + p = (void*)(1+1);// 11.6 + p = (void*)get_intptr_constant(); // 11.6 + p = (void*)s.i; // 11.6 p = ( void * )0; // no-warning (void)p; // no-warning // # 12184