cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Nicolas Koenig <koenigni@student.ethz.ch>
Cc: seth.arnold@canonical.com, cocci@systeme.lip6.fr
Subject: Re: [Cocci] Coccinelle question
Date: Thu, 09 May 2019 09:13:57 +0200	[thread overview]
Message-ID: <d286a21bb0748830aca6644daeecce33@lip6.fr> (raw)
In-Reply-To: <e31c049b-867d-5141-3563-17d528d482e7@student.ethz.ch>

> It seem to match. Running the following little patch/script
> 
> @@
> type T;
> identifier fn;
> @@
> 
> - T fn(
> + void fn(T *ret,
> 	...) {...}
> 
> generates, for example, the following diff
> 
> -int foo(void) {
> +void foo(int *ret, void) {
>    return 0;
>  }
> 
> Any idea what the best way to prevent this would be?

OK, sorry, I didn't notice that it was only ... in the matching part.  I 
think you could just put a dummy parameter:

@@
type T,T1;
identifier fn,i;
@@

- T fn(
+ void fn(T *ret,
	T1 i, ...) {...}

That should match cases with only one parameter, even though the , 
doesn't match anything.

julia


>> 
>>> Thank you in advance!
>>> 
>>>   Nicolas
>>> 
>>> P.S.: Is there a community where I can ask such questions without
>>> bothering people personally?
>> 
>> Yes, there is a mailing list.,  You should see this in the contact 
>> link at coccinelle.lip6.fr.  You should join the mailing list so I 
>> don't have to approve the posts.
> 
> Thank you, I've subscribed and added the list to this thread
> 
>   Nicolas
> 
>> 
>> julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2019-05-09  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <83363fd9-a6b1-28be-e0a7-168f205cb551@student.ethz.ch>
     [not found] ` <9c5ba524fec340a9c6ea8809e93ee0e8@lip6.fr>
2019-05-08 14:42   ` [Cocci] Coccinelle question Nicolas Koenig
2019-05-09  7:13     ` Julia Lawall [this message]
2013-04-24 10:03 Majid Java
2013-04-29  2:52 ` 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=d286a21bb0748830aca6644daeecce33@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=koenigni@student.ethz.ch \
    --cc=seth.arnold@canonical.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).