diff --git a/addons/misra_9.py b/addons/misra_9.py index b4f780bba..9f4c51af1 100644 --- a/addons/misra_9.py +++ b/addons/misra_9.py @@ -476,7 +476,13 @@ def createRecordChildrenDefs(ed, var): valueType = ed.valueType if not valueType or not valueType.typeScope: return - + typeToken = var.typeEndToken + while typeToken and typeToken.isName: + typeToken = typeToken.previous + if typeToken and typeToken.str == '*': + child = ElementDef("pointer", var.nameToken, var.nameToken.valueType) + ed.addChild(child) + return for variable in valueType.typeScope.varlist: if variable is var: continue diff --git a/addons/test/misra/crash3.c b/addons/test/misra/crash3.c new file mode 100644 index 000000000..19583f009 --- /dev/null +++ b/addons/test/misra/crash3.c @@ -0,0 +1,30 @@ + + + + +/* This is the representation of the expressions to determine the + plural form. */ +struct expression +{ + int nargs; /* Number of arguments. */ + union + { + unsigned long int num; /* Number value for `num'. */ + struct expression *args[3]; /* Up to three arguments. */ + } val; +}; + + +struct expression GERMANIC_PLURAL = +{ + .nargs = 2, + .val = + { + .args = + { + [0] = (struct expression *) &plvar, + [1] = (struct expression *) &plone + } + } +}; +