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.

Thank you for this great tool

Andrea

PS: the semantic patch I'm applying can be seen in the debug.log attachment
typedef struct _cairo_gstate cairo_gstate_t;

struct _cairo_gstate {
    cairo_font_face_t *font_face;
};

//typedef struct _cairo_gstate cairo_gstate_t;

int
_foo (cairo_gstate_t *gstate)
{
    cairo_font_face_t *font_face;

    if (gstate->font_face)
	return gstate->font_face->status;

    if (font_face->status)
	return font_face->status;
}

Attachment: debug.log
Description: Binary data

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

Reply via email to