Fix misra addon rule 4 1 (#1846)
* Modifiy check for MISRA rule 4.1 to avoid skipping constant character literal enclosed by single quotes. Add test for MISRA rule 4.1 which contains non-compliant cases defined by MISRA C 2012 document. * Moved additional test cases for MISRA rule 4.1 to appropriate test case section.
This commit is contained in:
parent
e9aaa5edfa
commit
149c07f475
|
@ -631,7 +631,7 @@ class MisraChecker:
|
||||||
|
|
||||||
def misra_4_1(self, rawTokens):
|
def misra_4_1(self, rawTokens):
|
||||||
for token in rawTokens:
|
for token in rawTokens:
|
||||||
if token.str[0] != '"':
|
if ((token.str[0] != '"') and (token.str[0] != '\'')):
|
||||||
continue
|
continue
|
||||||
pos = 1
|
pos = 1
|
||||||
while pos < len(token.str) - 2:
|
while pos < len(token.str) - 2:
|
||||||
|
|
|
@ -63,6 +63,8 @@ int misra_5_2_field_hides_field1_31y;//5.2
|
||||||
};
|
};
|
||||||
const char *s41_1 = "\x41g"; // 4.1
|
const char *s41_1 = "\x41g"; // 4.1
|
||||||
const char *s41_2 = "\x41\x42";
|
const char *s41_2 = "\x41\x42";
|
||||||
|
int c41_3 = '\141t'; // 4.1
|
||||||
|
int c41_4 = '\141\t';
|
||||||
|
|
||||||
extern int misra_5_3_var_hides_var______31x;
|
extern int misra_5_3_var_hides_var______31x;
|
||||||
void misra_5_3_var_hides_function_31x (void) {}
|
void misra_5_3_var_hides_function_31x (void) {}
|
||||||
|
|
Loading…
Reference in New Issue