This commit is contained in:
parent
915b4b6c5a
commit
12844703de
|
@ -2387,6 +2387,9 @@ class MisraChecker:
|
||||||
e = getEssentialType(token.astOperand2)
|
e = getEssentialType(token.astOperand2)
|
||||||
if not e:
|
if not e:
|
||||||
continue
|
continue
|
||||||
|
if e == "char" and vt1.type == "int":
|
||||||
|
# When arithmetic operations are performed on char values, they are usually promoted to int
|
||||||
|
continue
|
||||||
lhsbits = vt1.bits if vt1.bits else bitsOfEssentialType(vt1.type)
|
lhsbits = vt1.bits if vt1.bits else bitsOfEssentialType(vt1.type)
|
||||||
if lhsbits > bitsOfEssentialType(e):
|
if lhsbits > bitsOfEssentialType(e):
|
||||||
self.reportError(token, 10, 6)
|
self.reportError(token, 10, 6)
|
||||||
|
|
|
@ -749,7 +749,7 @@ static void misra_10_6(u8 x, char c1, char c2) {
|
||||||
u16 y1 = x+x; // 10.6
|
u16 y1 = x+x; // 10.6
|
||||||
u16 y2 = (0x100u - 0x80u); // rhs is not a composite expression because it's a constant expression
|
u16 y2 = (0x100u - 0x80u); // rhs is not a composite expression because it's a constant expression
|
||||||
u16 z = ~u8 x ;//10.6
|
u16 z = ~u8 x ;//10.6
|
||||||
s32 i = c1 - c2; // 10.3 FIXME: False positive for 10.6 (this is compliant). Trac #9488
|
s32 i = c1 - c2; // 10.3
|
||||||
struct misra_10_6_s s;
|
struct misra_10_6_s s;
|
||||||
s.a = x & 1U; // no-warning (#10487)
|
s.a = x & 1U; // no-warning (#10487)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue