I don't understand how, if it's possible, to qualify a function in a
rule.  I want the class of all functions having a parameter of a
particular type. 

The code I'm working with has hundreds of unnecessary casts.  Many
functions take a void* parameter, but are nonetheless called by casting
the parameter.  For example, the parameters to memcpy(3) often
have casts applied.  

I imagine writing a rule like

@@
type T, D;
identifier F(void*);
identifier D * data;
@@

- F((T*)data)
+ F(data)

but that doesn't work, and I haven't found anything that does.  

In the kmalloc examples, I see things like 

- \(kmalloc|kcmalloc\)(...)
+ mumble something

but that forces me to enumerate all such function names. It seems
vaguely like positions would do the trick, but, well, vaguely.  

Is there a way?  

--jkl
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to