On Thu, 14 Jun 2012, Sascha Wildner wrote:

> On Thu, 14 Jun 2012 20:55:12 +0200, Julia Lawall <[email protected]> wrote:
>
> > The problem is that there is an isomorphism that removes casts that no one
> > seems to care about, ie where the casted type is not used otherwise.  But
> > in this case, it means that the rule can match in two ways.  The solution
> > it to disable the isomorphism.  Make the very first line be
> >
> > @disable drop_cast@
> >
> > Julia
>
> Hmm, if I remember correctly, this worked for me:
>
> @@
> type T;
> T E;
> @@
> -(T)
> E

Yes, this would work as well.  The isomorphism would only apply when the
cast and the expression have the same transformation annotation.

Another advantage of this solution is that E is left as it is, ie with the
same whitespaceand newlines.  If coccinelle reconstructs E, then it will
use its own pretty printing defaults.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to