[Cocci] bug ? a newline after a cast to an unknown type prevents
from matching a function call
David Wagner
deubeuliou at gmail.com
Mon Mar 5 16:19:21 CET 2012
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 at 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.
More information about the Cocci
mailing list