Thanks for the report.  Coccinelle is not actually trying to parse the #if 
0 code.  If you want it to do that, you should give the argument 
-noif0_passing.  But it is applying the lexer to it, and thus giving the 
error message.  As a short term fix, perhaps you could just try the -c++ 
option?  I'll try to get rid of the error message.

julia


On Thu, 26 May 2011, Michael Stefaniuc wrote:

> Hello,
> 
> in Wine it is common to comment out code with #if 0. I do know that this
> is an advantage of coccinelle to ignore conditional compilation and thus
> find bugs in code that gets exercised only on odd architectures. But
> with #if 0 the code might not be even valid C:
> 
> #if 0
> float4 cTest::test(float2 vec)
> {
> }
> #endif
> 
> spatch -parse_c /tmp/if-0.c
> PARSING: /tmp/if-0.c
> Fatal error: exception Failure("lexical error ~ and :: not allowed in C
> identifiers, try -c++ option
>  =File "/tmp/if-0.c", line 2, column 7,  charpos = 13
>     around = 'cTest::test', whole content = float4 cTest::test(float2 vec)")
> 
> 
> Can coccinelle catch parse errors in #if 0'ed code, warn about it and
> fall back to treat it as a comment and go on with the parsing?
> 
> thanks
> bye
>       michael
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to