Hi,

I'm having trouble understanding coccinelles behaviour here. Consider the following C code and cocci rules:


#include <stdio.h>

int x;

int main(int argc, char **argv)
{
    f(x);
}


@@
identifier x;
@@
- int x;
+ int *x;

@@
int *x;
@@
- f(x)
+ g(x)



Since I read on some slides[0] that "Later rules see the results of earlier rules", I would assume that this would pick up the type change introduced by the first rule and replace f by g because it now has an "int *" parameter. However, spatch merely outputs the patch to change the type of x. If I change the type of the "expected" x in rule 2 to "int", cocci picks it up correctly.

Am I missing something?


[0]: http://events17.linuxfoundation.org/sites/events/files/slides/part1.pdf, page 43

--
Regards,
Christoph
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to