On Thu, 20 May 2010, Arnaud Lacombe wrote:
> Hi,
>
> I'm running into some [old] code using K&R C function definition:
>
> void
> rtalloc(ro)
> register struct route *ro;
> {
> ... function body ...
> }
>
> Which is making spatch fails with:
>
> bad: void
> BAD:!!!!! rtalloc(ro)
> ERROR-RECOV: found sync '}' at line 56
> parsing pass2: try again
> ERROR-RECOV: found sync '}' at line 56
> parse error
> = File "rt.c", line 27, column 0, charpos = 501
> around = '{', whole content = {
> badcount: 30
> bad: register struct route *ro;
> BAD:!!!!! {
> [...]
> SEMANTIC:parameter name omitted, but I continue
> TYPEDEF CONFLICT:prt
> TODO:typedef now used as an identifier
>
>
> While the Graal would be to have spatch be capable to convert K&R to
> ANSI C, would it be feasible to teach it not to fail on such
> declaration ?
There seems to be a bit more to triggering the error than the bit of code
shown above. I tried:
void
rtalloc(ro)
register struct route *ro;
{
foo();
return;
}
void
rtalloc(int ro)
{
foo();
return;
}
and the semantic patch:
@@
@@
- foo();
and had no problems. It didn't parse the K&R code, but it didn't crash
with the TODO either. Could you send a more complete example?
> Thanks in advance,
> - Arnaud
>
> ps: in general, where should parse error be sent ? here ? the webpage
> does not precise much in the "Contacts" page.
This address is fine for any sort of problems.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)