On Tue, 24 Jan 2012, Robert Gomulka wrote:
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).
That is because you are trying to remove it. The implicit isomorphism
converting an assignment to part of a variable declaration doesn't apply
when the assignment is removed.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)