* [Cocci] parameter list to expression list?
@ 2013-03-25 16:09 Michael Stefaniuc
2013-03-25 21:27 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Michael Stefaniuc @ 2013-03-25 16:09 UTC (permalink / raw)
To: cocci
Hello,
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)
{
return
- ret
+ bar(E)
;
}
thanks
bye
michael
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cocci] parameter list to expression list?
2013-03-25 16:09 [Cocci] parameter list to expression list? Michael Stefaniuc
@ 2013-03-25 21:27 ` Julia Lawall
2013-03-25 22:56 ` Michael Stefaniuc
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2013-03-25 21:27 UTC (permalink / raw)
To: cocci
On Mon, 25 Mar 2013, Michael Stefaniuc wrote:
> Hello,
>
> 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)
> {
> return
> - 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?
julia
^ permalink raw reply [flat|nested] 5+ messages in thread* [Cocci] parameter list to expression list?
2013-03-25 21:27 ` Julia Lawall
@ 2013-03-25 22:56 ` Michael Stefaniuc
[not found] ` <alpine.DEB.2.02.1303271828220.1904@hadrien>
0 siblings, 1 reply; 5+ messages in thread
From: Michael Stefaniuc @ 2013-03-25 22:56 UTC (permalink / raw)
To: cocci
On 03/25/2013 10:27 PM, Julia Lawall wrote:
> On Mon, 25 Mar 2013, Michael Stefaniuc wrote:
>
>> Hello,
>>
>> 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)
>> {
>> return
>> - 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:
@script:python new@
params << get.params;
args;
@@
import re
for p in params.elements:
coccinelle.args += ", " + re.sub(r".* (\w+)$", r"\1", p)
thanks
bye
michael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-08 8:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 16:09 [Cocci] parameter list to expression list? Michael Stefaniuc
2013-03-25 21:27 ` Julia Lawall
2013-03-25 22:56 ` Michael Stefaniuc
[not found] ` <alpine.DEB.2.02.1303271828220.1904@hadrien>
2013-04-08 8:57 ` Michael Stefaniuc
2013-04-08 8:59 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox