Misra: Add rule 3.1
This commit is contained in:
parent
ea67086da4
commit
82a68858ef
|
@ -12,6 +12,8 @@ typedef unsigned short u16;
|
|||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
//// 3.1
|
||||
|
||||
void misra_5_1() {
|
||||
int a123456789012345678901234567890; // no-warning
|
||||
int a1234567890123456789012345678901; // 5.1
|
||||
|
|
|
@ -268,6 +268,12 @@ def findInclude(directives, header):
|
|||
return directive
|
||||
return None
|
||||
|
||||
def misra_3_1(rawTokens):
|
||||
for token in rawTokens:
|
||||
if token.str.startswith('/*') or token.str.startswith('//'):
|
||||
if token.str[2:].find('//')>=0 or token.str[2:].find('/*')>=0:
|
||||
reportError(token, 3, 1)
|
||||
|
||||
def misra_5_1(data):
|
||||
for token in data.tokenlist:
|
||||
if token.isName and len(token.str) > 31:
|
||||
|
@ -994,6 +1000,8 @@ for arg in sys.argv[1:]:
|
|||
if len(data.configurations) > 1:
|
||||
print('Checking ' + arg + ', config "' + cfg.name + '"...')
|
||||
|
||||
if cfgNumber == 1:
|
||||
misra_3_1(data.rawTokens)
|
||||
misra_5_1(cfg)
|
||||
misra_5_3(cfg)
|
||||
misra_5_4(cfg)
|
||||
|
|
Loading…
Reference in New Issue