parent
4c7aae3a16
commit
681b15f5c9
|
@ -311,8 +311,7 @@ class InitializerParser:
|
||||||
if self.ed and self.ed.isValue:
|
if self.ed and self.ed.isValue:
|
||||||
if not isDesignated and len(self.rootStack) > 0 and self.rootStack[-1][1] == self.root:
|
if not isDesignated and len(self.rootStack) > 0 and self.rootStack[-1][1] == self.root:
|
||||||
self.rootStack[-1][0].markStuctureViolation(self.token)
|
self.rootStack[-1][0].markStuctureViolation(self.token)
|
||||||
|
if isFirstElement and self.token.isInt and self.token.getKnownIntValue() == 0 and self.token.next.str == '}':
|
||||||
if isFirstElement and self.token.str == '0' and self.token.next.str == '}':
|
|
||||||
# Zero initializer causes recursive initialization
|
# Zero initializer causes recursive initialization
|
||||||
self.root.initializeChildren()
|
self.root.initializeChildren()
|
||||||
elif self.token.isString and self.ed.valueType and self.ed.valueType.pointer > 0:
|
elif self.token.isString and self.ed.valueType and self.ed.valueType.pointer > 0:
|
||||||
|
|
|
@ -441,6 +441,7 @@ static void misra_9_empty_or_zero_initializers(void) {
|
||||||
int e[2][2] = { { 1 , 2 }, {} }; // 9.2
|
int e[2][2] = { { 1 , 2 }, {} }; // 9.2
|
||||||
|
|
||||||
int f[5] = { 0 };
|
int f[5] = { 0 };
|
||||||
|
int f1[5] = { 0u }; // no-warning #11298
|
||||||
int g[5][2] = { 0 };
|
int g[5][2] = { 0 };
|
||||||
int h[2][2] = { { 0 } }; // 9.3
|
int h[2][2] = { { 0 } }; // 9.3
|
||||||
int i[2][2] = { { 0 }, { 0 } };
|
int i[2][2] = { { 0 }, { 0 } };
|
||||||
|
|
Loading…
Reference in New Issue