Hi,

I may have stumbled upon a bug that prevents spatch from matching in a
special case:
The following SP is used:

@match@
identifier f;
position p;
@@
f@p
@script:python@
f << match.f;
p << match.p;
@@
print(f, p[0].line)



It won't print anything when used on the following C file:

void main() {
        unknown_tyepdef_1 td1;
        td1.attr = (unknown_typedef_2)
                td2.attr;
        foo();
}


however, on:
void main() {
        unknown_tyepdef_1 td1;
        td1.attr = (unknown_typedef_2) td2.attr;
        foo();
}

it finds
('foo', '4')
('td1', '3')
('td2', '3')

and on:
void main() {
        unknown_typedef_1 td1;
        td1.attr = (int)
                td2.attr;
        foo();
}

it finds the same symbols (different lines, of course)

If I define unknown_typedef_2 at the beginning of the file, it works
as expected, though.
Is it because coccinelle has no way to guess that it is a cast or is it a bug ?

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

Reply via email to