[Cocci] Change function invocations argument
julia.lawall at lip6.fr
Sat Dec 20 21:51:57 CET 2014
On Sat, 20 Dec 2014, Eliseo Martínez wrote:
> Great. That worked. Just one more thing, please.
> Some of the replacements done by the rule before leave literals of the form “(uintmax_t)34”.
> I would like to use an unsigned constant in those cases. This is, something like “34u”.
> So I add the following rule:
> @@ expression e1, e3; constant c2; @@
> 31 - put_bytes(e1, (uintmax_t)c2, e3)
> 32 + put_bytes(e1, c2, e3)
> That does the work, except adding the “u”. How could I do that?
> Is it possible adding something literally in the output?
> Is it possible to somehow say in line 32 “render c2 but with u suffix”?
It is possible, but somewhat awkward. Here is a simpler example that you
can adapt to your case:
c << r.c;
coccinelle.cu = "%su" % (c)
More information about the Cocci