On Tue, 19 Feb 2019, Timur Tabi wrote:

> The following rule fails with an error on the last line:
>
> @rule3@
> expression x, y, z;
> @@
> -DBG_PRINT_STRING_VALUE(x, y, z);
> +NV_PRINTF2(x, y "0x%x\n", z);
>
> Presumably, cocci doesn't know that "y" is a string constant and so
> the resulting expression is valid.  I'm guessing that I need to
> specify that "y" is a string constant, but even after reading
> http://coccinelle.lip6.fr/docs/main_grammar.html, I can't figure out
> what that could be.

SmPL doesn't support this.  The only solution I can see is to use python
code to construct an identifier variable that actually has the form of y
"0x%x\n".  You can see examples of how to use python to initialize
identifier metavariables in demos/pythontococci.cocci

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

Reply via email to