Re: [Cocci] Coccinelle question

Julia Lawall
2019-05-09T07:14:18Z

> 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