On Fri, 15 Jul 2011, Andrea Canciani wrote: > I'm having some trouble writing a semantic patch which looks for accesses > to a field in a structure and replaces it with function calls. > > The structure type is a typedef type, as in the mini_nok.c attachment. > The debug.log shows the result of > "spatch -sp cocci.spatches/cairo_test_status.cocci mini_nok.c -debug" > > I suspect that the issue is in spatch because of the > "(ONCE) Missing type information. Certainly a pb in annotate_typer.ml" > message and because commenting out the first typedef and uncommenting > the second one fixes the problem. > > Nevertheless, I'm a noob to semantic patches and I could very well be wrong, > so any hint towards the solution of the problem would be appreciated.
Yes, you have figured out the problem correctly. You can see it by running spatch -type_c mini_nok.c with the typedef in the two places. Coccinelle seems to take the information about the type that is available at the time of the typedef, not at the time of the use of the typedef. It should be possible to fix this. In the meantime, if you do not have many structures with fields of type cairo_font_face_t * maybe you can just make specific rules for each of them, to run before the rule for cairo_font_face_t *? julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
