>
>
> Because of the semicolon.  If you put a semicolon after an expression (an
> assignment is an expression in C), it becomes a complete statement.  So you
> want no semicolon, so that it just matches the inner assignment part.
>
> julia
>

I've tried that before:
virtual patch

@rule2@
expression x2;
idexpression x;
@@

- x = fun(x2)

And the result is:
diff -u -p a/test.c b/test.c
--- a/test.c
+++ b/test.c
@@ -4,7 +4,7 @@ int main(int argc, char ** argv) {
     int b=fun(2);
     int c;

-    c = fun(2);
+    ;

(please note intact b line).
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to