MISRA: add exception to rule 3.1 (#2231)
* misra: add exception to rule 3.1 * misra: add parenthesis for clarity in rule 3.1
This commit is contained in:
parent
50d82763fc
commit
40f136ac78
|
@ -740,9 +740,10 @@ class MisraChecker:
|
|||
|
||||
def misra_3_1(self, rawTokens):
|
||||
for token in rawTokens:
|
||||
if token.str.startswith('/*') or token.str.startswith('//'):
|
||||
starts_with_double_slash = token.str.startswith('//')
|
||||
if token.str.startswith('/*') or starts_with_double_slash:
|
||||
s = token.str.lstrip('/')
|
||||
if '//' in s or '/*' in s:
|
||||
if ((not starts_with_double_slash) and '//' in s) or '/*' in s:
|
||||
self.reportError(token, 3, 1)
|
||||
|
||||
|
||||
|
|
|
@ -19,9 +19,12 @@ typedef unsigned int u32;
|
|||
typedef signed int s32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
// // 3.1
|
||||
/* // */ // 3.1
|
||||
/* /* */ // 3.1
|
||||
////
|
||||
|
||||
// http://example.com // no warning
|
||||
|
||||
extern int misra_5_1_extern_var_hides_var_x;
|
||||
extern int misra_5_1_extern_var_hides_var_y; //5.1
|
||||
int misra_5_1_var_hides_var________a;
|
||||
|
|
Loading…
Reference in New Issue