Misra: Add rule 21.9
This commit is contained in:
parent
a3cd587af3
commit
1b1099201c
|
@ -221,3 +221,8 @@ void misra_21_8() {
|
||||||
getenv("foo"); // 21.8
|
getenv("foo"); // 21.8
|
||||||
system(""); // 21.8
|
system(""); // 21.8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void misra_21_9() {
|
||||||
|
bsearch(key,base,num,size,cmp); // 21.9
|
||||||
|
qsort(base,num,size,cmp); // 21.9
|
||||||
|
}
|
||||||
|
|
|
@ -679,6 +679,11 @@ def misra_21_8(data):
|
||||||
if (token.str in ['abort', 'getenv', 'system']) and token.next and token.next.str == '(':
|
if (token.str in ['abort', 'getenv', 'system']) and token.next and token.next.str == '(':
|
||||||
reportError(token, 21, 8)
|
reportError(token, 21, 8)
|
||||||
|
|
||||||
|
def misra_21_9(data):
|
||||||
|
for token in data.tokenlist:
|
||||||
|
if (token.str in ['bsearch', 'qsort']) and token.next and token.next.str == '(':
|
||||||
|
reportError(token, 21, 9)
|
||||||
|
|
||||||
if '-verify' in sys.argv[1:]:
|
if '-verify' in sys.argv[1:]:
|
||||||
VERIFY = True
|
VERIFY = True
|
||||||
|
|
||||||
|
@ -756,6 +761,7 @@ for arg in sys.argv[1:]:
|
||||||
misra_21_5(data.rawTokens)
|
misra_21_5(data.rawTokens)
|
||||||
misra_21_7(cfg)
|
misra_21_7(cfg)
|
||||||
misra_21_8(cfg)
|
misra_21_8(cfg)
|
||||||
|
misra_21_9(cfg)
|
||||||
|
|
||||||
if VERIFY:
|
if VERIFY:
|
||||||
for expected in VERIFY_EXPECTED:
|
for expected in VERIFY_EXPECTED:
|
||||||
|
|
Loading…
Reference in New Issue