diff --git a/addons/misra-test.c b/addons/misra-test.c index f067b6c0d..983b6d69f 100644 --- a/addons/misra-test.c +++ b/addons/misra-test.c @@ -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 diff --git a/addons/misra.py b/addons/misra.py index e177d397e..897029336 100644 --- a/addons/misra.py +++ b/addons/misra.py @@ -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)