On 07/10/2012 02:22 AM, Joe Perches wrote:
> I want to elide void * casts in uses of functions with
> pointers only when the function prototypes are declared
> with the appropriate void * arguments.
>
> Any idea/suggestion how to do this?
>
> I tried variants of this but had no success:
>
> @ func_1 @
> type rtn_type;
> identifier arg;
> @@
>
> static int func(void *arg)
> {
> ...
> }
>
> @@
> identifier func1.func;
> expression e;
> @@
>
> - fn((void *)e)
> + fn(e)
>
It works fine if you get rid of all the typos ;)
This one is a bit more generic since it allows the void parameter to be at
any position in the argument list:
@r1@
identifier arg;
identifier fn;
parameter list[n] P;
@@
fn(P, void *arg, ...)
{
...
}
@depends on r1@
expression e;
identifier r1.fn;
expression list[r1.n] El;
@@
- fn(El, (void *)e
+ fn(El, e
, ...)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)