All of lore.kernel.org
 help / color / mirror / Atom feed
From: jh1009.sung@samsung.com (Junghak Sung)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [cocci] Ask for help
Date: Tue, 07 Jul 2015 17:30:23 +0900	[thread overview]
Message-ID: <559B8E1F.2090803@samsung.com> (raw)

Hi~

I'm a newbie for coccinelle.
I would like to make a cocci file to patch like :

struct type_b *foo(void);

int some_function(...)
{
-struct type_a *v1, *v2;
+struct type_b *v1, *v2;
...
v1 = foo();
v2 = foo();
...
}

Return value of foo() was changed from struct type_a to struct type_b.
So, I want to find out the locations where a function use it in and 
modify the type of local variables.

If the number of local variable is just one, this cocci could make the 
patch well.

@@
identifier i;
@@
{
...
-struct type_a *i;
+struct type_b *i;
...
i = foo();
...
}

But, assuming that the number of local variables is two or more, I have 
failed again and again.
How can I make cocci file?
Thank you in advance for your consideration.

Best regards,
Junghak

             reply	other threads:[~2015-07-07  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  8:30 Junghak Sung [this message]
2015-07-07  8:49 ` [Cocci] [cocci] Ask for help Julia Lawall
2015-07-07 10:11   ` Junghak Sung
2015-07-07 10:43     ` Peter Senna Tschudin
2015-07-07 11:51     ` Julia Lawall
2015-07-08  0:55       ` Junghak Sung
2015-07-08  7:41         ` 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=559B8E1F.2090803@samsung.com \
    --to=jh1009.sung@samsung.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.