On 02/28/2012 08:31 PM, ron minnich wrote:
> I'm stuck on something I thought I knew how to do.
> 
> The first two rules in this file work, the third (which I just added)
> fails. The goal is to change instances of the function, uses of the
> struct, and
> prototype declarations of the function. I'm doing something simple
> wrong. I realize I could use alternation but I'm still learning.
Coccinelle detects it as a function call not as a function prototype as
it looks like a statement.
You need something like this (I prefer to add/remove the minimal
possible entity):
@@
identifier d, func;
type T;
@@
 T func(
-       struct drm_device *d
+       void
 );


> [rminnich@myhost video]$ cat deldev.cocci
> @@
> identifier func;
> identifier d;
> @@
> -func(struct drm_device *d)
> +func(void)
> {...}
> @@
> identifier dev;
> expression i;
> @@
> -struct drm_i915_private *dev = i;
> @@
> identifier func;
> identifier d;
> @@
> -func(struct drm_device *d);
> +func(void);
> 
> The error is as follows:
> 
> [rminnich@myhost video]$ spatch --in-place -sp_file deldev.cocci ib.c
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> 217 218
> Fatal error: exception Failure("minus: parse error:
>  = File "deldev.cocci", line 17, column 25,  charpos = 217
>     around = 'd', whole content = -func(struct drm_device *d);
> ")
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to