I have the impression that the C parer considers a #define to be a
statement. And it doesn't like there being a statement between the header
of a function and the opening brace. I can see if there is some way to
just skip over such a define. I guess the code exists already and it
would not be an option to just move the #define into the body of the
function?
julia
On Mon, 4 Jan 2010, Ludovic Courtès wrote:
> Hello, and best wishes,
>
> Coccinelleÿÿs parser appears to be confused by the definition of
> ÿÿFUNC_NAMEÿÿ in the example below:
>
> --8<---------------cut here---------------start------------->8---
> int foo (int bar)
> #define FUNC_NAME "foo"
> {
> return bar + 3;
> }
> #undef FUNC_NAME
> --8<---------------cut here---------------end--------------->8---
>
> Removing it or commenting it out lets it operate as expected.
>
> The example semantic patch I used is this:
>
> --8<---------------cut here---------------start------------->8---
> @@
> identifier e, f;
> @@
> - int f (int e)
> + int f (float e)
> {
> ...
> }
> --8<---------------cut here---------------end--------------->8---
>
> Is there any chance it could be fixed or otherwise worked around?
>
> Thanks,
> Ludoÿÿ.
> _______________________________________________
> 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)