misra.py: Fix crashes on obsolete GCC syntax for struct initialization (#3175)
* misra.py: Fix crashes on obsolete GCC syntax for struct initialization * Added expected violations
This commit is contained in:
parent
ad1f434c26
commit
390a5af064
|
@ -98,6 +98,8 @@ class ElementDef:
|
||||||
def getNextValueElement(self, root):
|
def getNextValueElement(self, root):
|
||||||
current = self
|
current = self
|
||||||
while current != root:
|
while current != root:
|
||||||
|
if not current.parent:
|
||||||
|
return None
|
||||||
# Get next index of parent
|
# Get next index of parent
|
||||||
i = current.parent.children.index(current) + 1
|
i = current.parent.children.index(current) + 1
|
||||||
# Next index of parent exists
|
# Next index of parent exists
|
||||||
|
|
|
@ -442,6 +442,9 @@ void misra_9_struct_initializers() {
|
||||||
dummy_struct dsd[2][2] = { 1, 2, 3, 4 }; // 9.2
|
dummy_struct dsd[2][2] = { 1, 2, 3, 4 }; // 9.2
|
||||||
dummy_struct dse[3] = { {1,2}, {3,4}, [1] = {5,6} }; // 9.3 9.4
|
dummy_struct dse[3] = { {1,2}, {3,4}, [1] = {5,6} }; // 9.3 9.4
|
||||||
dummy_struct dsd[] = { [0] = 1 }; // 9.5
|
dummy_struct dsd[] = { [0] = 1 }; // 9.5
|
||||||
|
|
||||||
|
// Obsolete initialization syntax for GCC
|
||||||
|
struct1 os1 = { i1: 1, i2: 2 }; // 10.4 13.4
|
||||||
}
|
}
|
||||||
|
|
||||||
void misra_9_broken_initializers() {
|
void misra_9_broken_initializers() {
|
||||||
|
|
Loading…
Reference in New Issue