On Sat, 20 Dec 2014, Eliseo Martínez wrote:

> Hi, 
> 
> For a given function, I want to change all invocations in this way:
> Turn the second argument of the form “(long_u)(expression)” into 
> “(uintmax_t)expression”.
> I’ve done a patch for that but is failing with a not very much informative 
> message error.
> Here is it:
> 
> ```
> eliseo@ubuntu:~/projects/os/neovim/neovim$ cat sample.cocci 
> @@ expression e1, e2, e3; @@
> 
>   put_bytes(
>     e1,
> -   (long_u)(e2),
> +   (uintmax_t)e2,
>     e3)

long_u and uintmax_t are not part of the C language, and Coccinelle is not 
always able to infer typedefs.  Just add:

typedef long_u, uintmax_t;

in your metavariable list.  This should only be done in the first rule in 
which the typename is relevant.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to