Fixed #8656 (false positive: MISRA rule 10.1)
This commit is contained in:
parent
8c7ae14f0b
commit
43aabcd318
|
@ -98,6 +98,14 @@ def getEssentialTypeCategory(expr):
|
||||||
return None
|
return None
|
||||||
if expr.valueType and expr.valueType.typeScope:
|
if expr.valueType and expr.valueType.typeScope:
|
||||||
return "enum<" + expr.valueType.typeScope.className + ">"
|
return "enum<" + expr.valueType.typeScope.className + ">"
|
||||||
|
if expr.astOperand1 and expr.astOperand2:
|
||||||
|
e1 = getEssentialTypeCategory(expr.astOperand1)
|
||||||
|
e2 = getEssentialTypeCategory(expr.astOperand2)
|
||||||
|
#print('{0}: {1} {2}'.format(expr.str, e1, e2))
|
||||||
|
if e1 and e2 and e1 == e2:
|
||||||
|
return e1
|
||||||
|
if expr.valueType:
|
||||||
|
return expr.valueType.sign
|
||||||
if expr.variable:
|
if expr.variable:
|
||||||
typeToken = expr.variable.typeStartToken
|
typeToken = expr.variable.typeStartToken
|
||||||
while typeToken:
|
while typeToken:
|
||||||
|
|
|
@ -161,9 +161,10 @@ void misra_9_5() {
|
||||||
int x[] = {[0]=23}; // 9.5
|
int x[] = {[0]=23}; // 9.5
|
||||||
}
|
}
|
||||||
|
|
||||||
void misra_10_1() {
|
void misra_10_1(uint8_t u) {
|
||||||
int32_t i;
|
int32_t i;
|
||||||
i = 3 << 1; // 10.1
|
i = 3 << 1; // 10.1
|
||||||
|
i = (u & u) << 4; // no-warning
|
||||||
}
|
}
|
||||||
|
|
||||||
void misra_10_4(u32 x, s32 y) {
|
void misra_10_4(u32 x, s32 y) {
|
||||||
|
|
Loading…
Reference in New Issue