misra: fix 9.x checking when string literals are used to initialize char arrays (#5234)

This commit is contained in:
Daniel Marjamäki 2023-07-11 17:57:55 +02:00 committed by GitHub
parent 80c42fcaf3
commit 9c5275f514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -346,15 +346,9 @@ class InitializerParser:
parent = parent.parent
isDesignated = False
if self.token.isString:
if self.token == self.token.astParent.astOperand1 and self.token.astParent.astOperand2:
self.token = self.token.astParent.astOperand2
self.ed.markAsCurrent()
self.ed = self.root.getNextChild()
else:
self.unwindAndContinue()
else:
self.unwindAndContinue()
if self.token.isString and self.ed.parent.isArray:
self.ed = self.ed.parent
self.unwindAndContinue()
def pushToRootStackAndMarkAsDesignated(self):
new = self.ed.parent

View File

@ -0,0 +1,10 @@
struct three_d_filter_t {
char name[16];
double elem[2];
};
static three_d_filter_t base_filters[] = {
{"Identity", { 1.0, 0.0 } },
{"Echo", { 0.4, 0.0 } }
};