MISRA Rule 11.6 will no longer report violation on '(void)p;' (#1272)

This commit is contained in:
Konrad Grochowski 2018-05-30 12:44:20 +02:00 committed by Daniel Marjamäki
parent cc77a6aa62
commit e1014253ef
2 changed files with 5 additions and 4 deletions

View File

@ -901,7 +901,7 @@ def misra_11_6(data):
continue continue
if vt1.pointer == 1 and vt1.type == 'void' and vt2.pointer == 0 and token.astOperand1.str != "0": if vt1.pointer == 1 and vt1.type == 'void' and vt2.pointer == 0 and token.astOperand1.str != "0":
reportError(token, 11, 6) reportError(token, 11, 6)
elif vt1.pointer == 0 and vt2.pointer == 1 and vt2.type == 'void': elif vt1.pointer == 0 and vt1.type != 'void' and vt2.pointer == 1 and vt2.type == 'void':
reportError(token, 11, 6) reportError(token, 11, 6)

View File

@ -198,7 +198,8 @@ void misra_11_6() {
void *p; void *p;
p = (void*)123; // 11.6 p = (void*)123; // 11.6
x = (u64)p; // 11.6 x = (u64)p; // 11.6
p = ( void * )0 // no-warning p = ( void * )0; // no-warning
(void)p; // no-warning
} }