On Thu, 6 Oct 2016, Michal Kazior wrote:

> Hi,
>
> I've been struggling to get spatch to parse the following code properly:
>
> struct foo {
>         int hello;
>         BAR(int) world;
> };
>
> int bar(int wut) {
>         BAR(int) world;
>         return 0;
> }
>
> My cocci is:
>
> @@ @@
> * struct foo { ... };
>
> @@ @@
> * int bar(...) { ... }
>
> If I specify -macro_file which includes:
>
> #define BAR(x)
>
> With v1.0.6 I only get:
>
> -int bar(int wut) {
> -       BAR(int) world;
> -       return 0;
> -}
>
> (i.e. "struct foo" is not recognized)
>
> v1.0.4 gives me nothing.
>
> If I specify -macro_file which includes:
>
> #define BAR(x) x
>
> I get nothing from both 1.0.4 and 1.0.6 except a complaint "try to
> delete an expanded token: int".
>
> Is this expected/known?

Yes.  Unfortunately you cannot transform macro expanded code.  I think
that this issue is that it would be hard to know what to do if the code
was partially deleted.  It could be nice to allow completely deleting it,
but probably the information about whether that is the case is not
avalable.

julia

>
>
> MichaƂ
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to