Modified rule 11.5 (#1256)

This commit is contained in:
Swasti Shrivastava 2018-05-22 18:02:00 +05:30 committed by Daniel Marjamäki
parent 5505cbac26
commit c73dc63537
2 changed files with 11 additions and 0 deletions

View File

@ -802,6 +802,15 @@ def misra_11_4(data):
def misra_11_5(data):
for token in data.tokenlist:
if not isCast(token):
if token.str == "=" and token.next.str != "(":
vt1 = token.astOperand1.valueType
vt2 = token.astOperand2.valueType
if not vt1 or not vt2:
continue
if vt1.pointer > 0 and vt1.type != 'void' and vt2.pointer == vt1.pointer and vt2.type == 'void':
reportError(token, 11, 5)
continue
if token.astOperand1.astOperand1 and token.astOperand1.astOperand1.str in {'malloc', 'calloc', 'realloc', 'free'}:
continue
vt1 = token.valueType
vt2 = token.astOperand1.valueType

View File

@ -179,7 +179,9 @@ void misra_11_4(u8*p) {
}
void misra_11_5(void *p) {
u16 *p16;
x = (u8 *)p; // 11.5
p16 = p; //11.5
}
void misra_11_6() {