All of lore.kernel.org
 help / color / mirror / Atom feed
From: mstefani@redhat.com (Michael Stefaniuc)
To: cocci@systeme.lip6.fr
Subject: [Cocci] parameter list to expression list?
Date: Mon, 25 Mar 2013 23:56:59 +0100	[thread overview]
Message-ID: <5150D63B.9000806@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1303252225550.2046@localhost6.localdomain6>

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

  reply	other threads:[~2013-03-25 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found]     ` <alpine.DEB.2.02.1303271828220.1904@hadrien>
2013-04-08  8:57       ` Michael Stefaniuc
2013-04-08  8:59         ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5150D63B.9000806@redhat.com \
    --to=mstefani@redhat.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.