On Thu, 15 Nov 2018, Timur Tabi wrote:
> Is it possible for a Python code snippet to be passed the name of the
> current function? I already have Python code in my .cocci file that
> cleans up the text of some string literals. I want to add more code
> that removes the current function name from the beginning of a string
> literal. So for instance, If I have
>
> void myfunc(void)
> {
> ...
> NV_PRINTF("myfunc: xxx\n");
>
> I want to replace the NV_PRINTF line with:
>
> NV_PRINTF("xxx\n");
>
> To do that, the Python code would need to given "myfunc" as a
> parameter of some kind.
The name of the current function at a given match is available in a
position variable bound as part of that match. A position variable should
have a current_element field.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci