parent
a8eb971670
commit
db66105128
|
@ -569,6 +569,7 @@ class Scope:
|
|||
function = None
|
||||
nestedInId = None
|
||||
nestedIn = None
|
||||
nestedList = None
|
||||
type = None
|
||||
isExecutable = None
|
||||
varlistId = None
|
||||
|
@ -586,6 +587,7 @@ class Scope:
|
|||
self.bodyEnd = None
|
||||
self.nestedInId = element.get('nestedIn')
|
||||
self.nestedIn = None
|
||||
self.nestedList = list()
|
||||
self.type = element.get('type')
|
||||
self.definedType = element.get('definedType')
|
||||
self.isExecutable = (self.type in ('Function', 'If', 'Else', 'For', 'While', 'Do',
|
||||
|
@ -606,6 +608,8 @@ class Scope:
|
|||
self.bodyStart = IdMap[self.bodyStartId]
|
||||
self.bodyEnd = IdMap[self.bodyEndId]
|
||||
self.nestedIn = IdMap[self.nestedInId]
|
||||
if self.nestedIn:
|
||||
self.nestedIn.nestedList.append(self)
|
||||
self.function = IdMap[self.functionId]
|
||||
for v in self.varlistId:
|
||||
value = IdMap.get(v)
|
||||
|
|
|
@ -500,11 +500,29 @@ def createRecordChildrenDefs(ed, var):
|
|||
child = ElementDef("pointer", var.nameToken, var.nameToken.valueType)
|
||||
ed.addChild(child)
|
||||
return
|
||||
child_dict = {}
|
||||
for variable in valueType.typeScope.varlist:
|
||||
if variable is var:
|
||||
continue
|
||||
child = getElementDef(variable.nameToken)
|
||||
ed.addChild(child)
|
||||
child_dict[variable.nameToken] = child
|
||||
for scopes in valueType.typeScope.nestedList:
|
||||
varscope = False
|
||||
if scopes.nestedIn == valueType.typeScope:
|
||||
for variable in valueType.typeScope.varlist:
|
||||
if variable.nameToken and variable.nameToken.valueType and variable.nameToken.valueType.typeScope == scopes:
|
||||
varscope = True
|
||||
break
|
||||
if not varscope:
|
||||
ed1 = ElementDef("record", scopes.Id, valueType)
|
||||
for variable in scopes.varlist:
|
||||
child = getElementDef(variable.nameToken)
|
||||
ed1.addChild(child)
|
||||
child_dict[scopes.bodyStart] = ed1
|
||||
sorted_keys = sorted(list(child_dict.keys()), key=lambda k: "%s %s %s" % (k.file, k.linenr, k.column))
|
||||
for _key in sorted_keys:
|
||||
ed.addChild(child_dict[_key])
|
||||
|
||||
|
||||
def getElementByDesignator(ed, token):
|
||||
if not token.str in [ '.', '[' ]:
|
||||
|
|
|
@ -418,6 +418,21 @@ static void misra_8_14(char * restrict str) {(void)str;} // 8.14
|
|||
struct S_9_3 { struct S_9_3* p; int x; };
|
||||
struct S_9_3* s_9_3_array[] = { x, NULL }; // 8.4
|
||||
|
||||
// #10854
|
||||
struct Entry_9_2{
|
||||
union{ // 19.2
|
||||
const int *p;
|
||||
int x;
|
||||
};
|
||||
int y;
|
||||
};
|
||||
|
||||
static void misra_9_2_10854(void){
|
||||
struct Entry_9_2 e1[] =
|
||||
{
|
||||
{{ .x = 1 }, .y = 2 }
|
||||
};
|
||||
}
|
||||
static void misra_9_empty_or_zero_initializers(void) {
|
||||
int a[2] = {}; // 9.2
|
||||
int b[2][2] = {}; // 9.2
|
||||
|
|
Loading…
Reference in New Issue