[Cocci] parameter list to expression list?
mstefani at redhat.com
Mon Mar 25 23:56:59 CET 2013
On 03/25/2013 10:27 PM, Julia Lawall wrote:
> On Mon, 25 Mar 2013, Michael Stefaniuc wrote:
>> is there an intrinsic way to get from a parameter list to an expression
>> list? That would come in handy when forwarding from one function to
>> another one. At the moment I help myself with a python rule that
>> transforms the parameter list to an identifier but that feels clumsy.
>> E.g. in SmPL pseudo code something like this would be nice:
>> type T;
>> parameter list P;
>> expression list E = P;
>> expression ret;
>> T foo(P)
>> - ret
>> + bar(E)
> No, there is nothing. I guess your transformation gets rid of the types in
> the parameter list? Perhaps what you would liek is a way to just match
> the list of identifier parts?
Yes, something like that.
What I do now is:
params << get.params;
for p in params.elements:
coccinelle.args += ", " + re.sub(r".* (\w+)$", r"\1", p)
More information about the Cocci