diff --git a/addons/misra_9.py b/addons/misra_9.py index 5f0b9d624..653245322 100644 --- a/addons/misra_9.py +++ b/addons/misra_9.py @@ -98,6 +98,8 @@ class ElementDef: def getNextValueElement(self, root): current = self while current != root: + if not current.parent: + return None # Get next index of parent i = current.parent.children.index(current) + 1 # Next index of parent exists diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index d0c763af2..32ad998c6 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -442,6 +442,9 @@ void misra_9_struct_initializers() { 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 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() {