Misra: Add rule 21.7
This commit is contained in:
parent
95048527d0
commit
a5b3fe3998
|
@ -208,3 +208,7 @@ void misra_21_3() {
|
|||
realloc(10); // 21.3
|
||||
free(p1); // 21.3
|
||||
}
|
||||
|
||||
void misra_21_7() {
|
||||
atoi(str); // 21.7
|
||||
}
|
||||
|
|
|
@ -669,6 +669,10 @@ def misra_21_5(rawTokens):
|
|||
if headerToken and headerToken.str == '<signal.h>':
|
||||
reportError(token, 21, 5)
|
||||
|
||||
def misra_21_7(data):
|
||||
for token in data.tokenlist:
|
||||
if (token.str in ['atof', 'atoi', 'atol', 'atoll']) and token.next and token.next.str == '(':
|
||||
reportError(token, 21, 7)
|
||||
|
||||
if '-verify' in sys.argv[1:]:
|
||||
VERIFY = True
|
||||
|
@ -745,6 +749,7 @@ for arg in sys.argv[1:]:
|
|||
if cfgNumber == 1:
|
||||
misra_21_4(data.rawTokens)
|
||||
misra_21_5(data.rawTokens)
|
||||
misra_21_7(cfg)
|
||||
|
||||
if VERIFY:
|
||||
for expected in VERIFY_EXPECTED:
|
||||
|
|
Loading…
Reference in New Issue