cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Are types re-evaluated between subsequent rules?
@ 2019-05-27 13:32 Christoph Böhmwalder
  2019-05-27 14:16 ` [Cocci] Checking change scope for a data type replacement Markus Elfring
  2019-05-27 14:28 ` [Cocci] Are types re-evaluated between subsequent rules? Julia Lawall
  0 siblings, 2 replies; 8+ messages in thread
From: Christoph Böhmwalder @ 2019-05-27 13:32 UTC (permalink / raw)
  To: cocci

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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-27 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 13:32 [Cocci] Are types re-evaluated between subsequent rules? Christoph Böhmwalder
2019-05-27 14:16 ` [Cocci] Checking change scope for a data type replacement Markus Elfring
2019-05-27 14:30   ` Christoph Böhmwalder
2019-05-27 15:00     ` Markus Elfring
2019-05-27 17:40     ` Markus Elfring
2019-05-27 17:46       ` Julia Lawall
2019-05-27 19:12         ` Markus Elfring
2019-05-27 14:28 ` [Cocci] Are types re-evaluated between subsequent rules? Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).