Misra: Add rule 4.3
This commit is contained in:
parent
f90d8c9987
commit
eb11667c22
|
@ -10,6 +10,11 @@
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
|
|
||||||
|
void misra_4_3() {
|
||||||
|
dostuff();
|
||||||
|
asm("abc"); // 4.3
|
||||||
|
}
|
||||||
|
|
||||||
void misra_5_1() {
|
void misra_5_1() {
|
||||||
int a123456789012345678901234567890; // no-warning
|
int a123456789012345678901234567890; // no-warning
|
||||||
int a1234567890123456789012345678901; // 5.1
|
int a1234567890123456789012345678901; // 5.1
|
||||||
|
|
|
@ -235,6 +235,13 @@ def findInclude(rawTokens, header):
|
||||||
return headerToken
|
return headerToken
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def misra_4_3(data):
|
||||||
|
for token in data.tokenlist:
|
||||||
|
if not simpleMatch(token, 'asm ('):
|
||||||
|
continue
|
||||||
|
if token.scope.type != 'Function' or (not token.previous) or token.previous.str != '{' or (not simpleMatch(token.next.link, ') ; }')):
|
||||||
|
reportError(token, 4, 3)
|
||||||
|
|
||||||
def misra_5_1(data):
|
def misra_5_1(data):
|
||||||
for token in data.tokenlist:
|
for token in data.tokenlist:
|
||||||
if token.isName and len(token.str) > 31:
|
if token.isName and len(token.str) > 31:
|
||||||
|
@ -716,6 +723,7 @@ for arg in sys.argv[1:]:
|
||||||
if len(data.configurations) > 1:
|
if len(data.configurations) > 1:
|
||||||
print('Checking ' + arg + ', config "' + cfg.name + '"...')
|
print('Checking ' + arg + ', config "' + cfg.name + '"...')
|
||||||
|
|
||||||
|
misra_4_3(cfg)
|
||||||
misra_5_1(cfg)
|
misra_5_1(cfg)
|
||||||
if cfgNumber == 1:
|
if cfgNumber == 1:
|
||||||
misra_7_1(data.rawTokens)
|
misra_7_1(data.rawTokens)
|
||||||
|
|
Loading…
Reference in New Issue