All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Adding parameter to function if missing
Date: Wed, 6 Jul 2016 18:50:42 +0200	[thread overview]
Message-ID: <4a1dcd24-efeb-902c-f239-d620850b4dbe@users.sourceforge.net> (raw)
In-Reply-To: <bda6f254dbe94ad28468d5de4b6c3a17@vprd-opci0018.b-com.local>

> I am new to coccinelle and I have trouble to use it.

Which software versions do you try out here?


> What I want to do is add a missing parameter to a function call (bar)

This is usual.


> and add this parameter to the function prototype calling it if missing.

I imagine that there are further software development challenges to consider
for such a source code transformation in header files.


> I tried several ways to do it without success. If I add a negative depends on rule, it won't work.

Do you get an error message?


> @fn_with_user@
> identifier fn, foo;
> typedef my_type;

How do you think about the SmPL specification "type my_type;" here?


> parameter list pl;
> expression E; 
> @@
> 
> fn(my_type *foo, pl) {
> <+... 
> bar(foo, E);
> ...+> 
> }
> 
> @ test depends on !fn_with_user@
> identifier fn_with_user.fn;

Will it make sense to add the SmPL specification "type fn_with_user.my_type;" here?


> parameter list pl;
> expression E;
> @@    
> 
> fn(
> + my_type *foo,
> pl) {
> <+...
> bar(foo, E);

Would you like to merge this place with your first SmPL rule?

 bar(
+    foo,
     E);


> Could you help me ?

I hope so.

Regards,
Markus

  parent reply	other threads:[~2016-07-06 16:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 13:54 [Cocci] Adding missing parameter to function if missing Frédéric LEROY (ext)
2016-07-06 16:23 ` Julia Lawall
2016-07-07 12:18   ` Frédéric LEROY (ext)
2016-07-07 16:14     ` [Cocci] Adding " SF Markus Elfring
2016-07-08 10:46       ` Frédéric LEROY (ext)
2016-07-07 17:09     ` [Cocci] Adding missing " Julia Lawall
2016-07-06 16:50 ` SF Markus Elfring [this message]
2016-07-07 11:54   ` [Cocci] Adding " Frédéric LEROY (ext)
2016-07-07 15:43     ` SF Markus Elfring

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=4a1dcd24-efeb-902c-f239-d620850b4dbe@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --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.