[Cocci] Change function invocations argument

Eliseo Martínez eliseomarmol at gmail.com
Sat Dec 20 21:21:17 CET 2014


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 at ubuntu:~/projects/os/neovim/neovim$ cat sample.cocci 
@@ expression e1, e2, e3; @@

  put_bytes(
    e1,
-   (long_u)(e2),
+   (uintmax_t)e2,
    e3)

eliseo at ubuntu:~/projects/os/neovim/neovim$ spatch --parse-cocci sample.cocci 
init_defs_builtins: /usr/share/coccinelle/standard.h
84 86
Fatal error: exception Failure("plus: parse error: 
 = File "sample.cocci", line 6, column 15,  charpos = 84
    around = 'e2', whole content = +   (uintmax_t)e2,
“)
```

What I’m doing wrong here??
Thanks.


More information about the Cocci mailing list