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
if vt1.pointer == 1 and vt1.type == 'void' and vt2.pointer == 0 and token.astOperand1.str != "0":
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)

View File

@ -196,9 +196,10 @@ void misra_11_5(void *p) {
void misra_11_6() {
void *p;
p = (void*)123; // 11.6
x = (u64)p; // 11.6
p = ( void * )0 // no-warning
p = (void*)123; // 11.6
x = (u64)p; // 11.6
p = ( void * )0; // no-warning
(void)p; // no-warning
}