Misra: Added rule 13.6
This commit is contained in:
parent
cead8a62b4
commit
0c26d9e470
|
@ -56,6 +56,10 @@ void misra_13_5() {
|
||||||
if (x && (y++ < 123)){} // 13.5
|
if (x && (y++ < 123)){} // 13.5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void misra_13_6() {
|
||||||
|
return sizeof(x++); // 13.6
|
||||||
|
}
|
||||||
|
|
||||||
void misra_14_4() {
|
void misra_14_4() {
|
||||||
if (x+4){} // 14.4
|
if (x+4){} // 14.4
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,6 +268,11 @@ def misra_13_5(data):
|
||||||
if token.isLogicalOp and hasSideEffectsRecursive(token.astOperand2):
|
if token.isLogicalOp and hasSideEffectsRecursive(token.astOperand2):
|
||||||
reportError(token, 13, 5)
|
reportError(token, 13, 5)
|
||||||
|
|
||||||
|
def misra_13_6(data):
|
||||||
|
for token in data.tokenlist:
|
||||||
|
if token.str == 'sizeof' and hasSideEffectsRecursive(token.next):
|
||||||
|
reportError(token, 13, 6)
|
||||||
|
|
||||||
def misra_14_4(data):
|
def misra_14_4(data):
|
||||||
for token in data.tokenlist:
|
for token in data.tokenlist:
|
||||||
if token.str != '(':
|
if token.str != '(':
|
||||||
|
@ -308,5 +313,6 @@ for arg in sys.argv[1:]:
|
||||||
misra_13_3(cfg)
|
misra_13_3(cfg)
|
||||||
misra_13_4(cfg)
|
misra_13_4(cfg)
|
||||||
misra_13_5(cfg)
|
misra_13_5(cfg)
|
||||||
|
misra_13_6(cfg)
|
||||||
misra_14_4(cfg)
|
misra_14_4(cfg)
|
||||||
misra_15_1(cfg)
|
misra_15_1(cfg)
|
||||||
|
|
Loading…
Reference in New Issue