On 5 January 2012 14:36, Julia Lawall <[email protected]> wrote:
> Do you really need to use regular expressions in all of these cases?  If you
> don't need to use regular expressions, then it is better to avoid them.
>  Normally, if you have some function names in your semantic patch, and they
> are essential for the semantic patch to apply, Coccinelle will be applied to
> only files that contain these function names.  With regular expressions, it
> does not do this optimization.
>
> If you want to see what it is filtering on, you can run spatch -parse_cocci
> file.cocci, and the list of required words appears at the end of the output.
>
> julia
>

I wasn't aware of such thing.
I think I can drop regular expressions for daily usage, however they
were nice to identify all possible (possible only) memory allocation
function invocations.

Now I have something like:
@@
type T;
T *x;
@@

(
 malloc
|
 kmalloc
|
 custom_malloc
)
 (
-  x
+  *(x)
 )

repeated for realloc and calloc.

Btw.
is it possible to combine positive and negative regular expressions?
As I said above, I'd rather drop them altogether, however I'm just
curious whether it's possible to search for functions ending with
malloc, but not "bad_malloc" and "another_malloc" (because they have
separate API)?

Best regards,
Robert
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to