Misra: Add rule 15.5
This commit is contained in:
parent
4ebe520858
commit
ec72330e7a
|
@ -93,3 +93,11 @@ void misra_15_3() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int misra_15_5() {
|
||||
if (x!=0) {
|
||||
return 1; // 15.5
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -364,6 +364,11 @@ def misra_15_3(data):
|
|||
if not scope:
|
||||
reportError(token, 15, 3)
|
||||
|
||||
def misra_15_5(data):
|
||||
for token in data.tokenlist:
|
||||
if token.str == 'return' and token.scope.type != 'Function':
|
||||
reportError(token, 15, 5)
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
print('Checking ' + arg + '...')
|
||||
data = cppcheckdata.parsedump(arg)
|
||||
|
@ -395,5 +400,6 @@ for arg in sys.argv[1:]:
|
|||
misra_15_1(cfg)
|
||||
misra_15_2(cfg)
|
||||
misra_15_3(cfg)
|
||||
misra_15_5(cfg)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue