On Thu, 1 May 2014, Akos PASZTORY wrote:

> Hi,
> 
> what did I mess up below?
> I was trying to mangle all arguments of a call but the last one is not 
> handled:
> 
> $ cat bug.c
> void foo() {
>     bar(a,b,c);
> }
> $ cat bug.cocci
> @@ expression e; @@
> bar(...,
> - e,
> + XYZ(e),
> ...)

Just move the comma out of the transformed part:

@@ expression e; @@
bar(...,
- e
+ XYZ(e)
,...)

julia


> $ spatch --sp-file bug.cocci bug.c
> init_defs_builtins: /usr/share/coccinelle/standard.h
> HANDLING: bug.c
> diff =
> --- bug.c
> +++ /tmp/cocci-output-27316-d0cede-bug.c
> @@ -1,3 +1,3 @@
>  void foo() {
> -    bar(a,b,c);
> +    bar(XYZ(a), XYZ(b), c);
>  }
> $ spatch --version
> spatch version 1.0.0-rc21 with Python support and with PCRE support
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
> 
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to