Defining a function with a default parameter, the AST comes out differently depending on if the default param is the first and only or the second parameter. void foo(int* param = 0)
If it's the first parameter, the first operand of the "=" is "param". void foo(int bar, int* param = 0)
If it's the second param, the first parameter of the "=" is the "*", which confuses the rule check for MISRA-C-2012 rule 11_9.
The dump looks like this:
(look for astOperand1="0x2979be0" for str="=" in the 3rd to last line , which is the token id of str="param")
Defining a function with a default parameter, the AST comes out differently depending on if the default param is the first and only or the second parameter.
void foo(int* param = 0)
If it's the first parameter, the first operand of the "=" is "param".
void foo(int bar, int* param = 0)
If it's the second param, the first parameter of the "=" is the "*", which confuses the rule check for MISRA-C-2012 rule 11_9.
The dump looks like this:
(look for
astOperand1="0x2979be0
" forstr="="
in the 3rd to last line , which is the token id ofstr="param"
)for the second function:
(look for
astOperand1="0x29cf860"
forstr="="
on the 3rd to last line, which is the token id ofstr="*"
)Has this a higher meaning I'm not aware of or is this a bug in the AST generation?