Fixed #9988 (false positive: misra-c2012-9.2) (#2904)

This commit is contained in:
Ivar Andreas Bonsaksen 2020-11-16 17:31:00 +01:00 committed by GitHub
parent 4d3f76b63c
commit 0e7ec1eddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -1721,7 +1721,8 @@ class MisraChecker:
while not eq.isAssignmentOp and eq.astParent: while not eq.isAssignmentOp and eq.astParent:
eq = eq.astParent eq = eq.astParent
if not eq.isAssignmentOp: # We are only looking for initializers
if not eq.isAssignmentOp or eq.astOperand2.isName:
continue continue
if variable.isArray : if variable.isArray :

View File

@ -1247,7 +1247,7 @@ void misra_18_8(int x) {
int buf1[10]; int buf1[10];
int buf2[sizeof(int)]; int buf2[sizeof(int)];
int vla[x]; // 18.8 int vla[x]; // 18.8
static const unsigned char arr18_8_1[] = UNDEFINED_ID; // 9.2 static const unsigned char arr18_8_1[] = UNDEFINED_ID;
static uint32_t enum_test_0[R18_8_ENUM_CONSTANT_0] = {0}; static uint32_t enum_test_0[R18_8_ENUM_CONSTANT_0] = {0};
} }