[Cocci] keeping cast affects match?

Julia Lawall julia.lawall at lip6.fr
Wed Feb 17 16:12:42 CET 2016


On Wed, 17 Feb 2016, Wolfram Sang wrote:

> > The isomorphism that allows ignoring a cast only works when the type
> > metavariable is used only once.  You uare using it twice.  The fact that
> > you wanted to add it indicates that you really want it to be there.
>
> Aha, I understand. Thank you for the explanation!
>
> > I think that everything should be fine if you just move the (T) out of the
> > removed and added code.
>
> Much better! I still fall for thinking too much in terms of 'lines'
> instead of 'tokens'. Prompt and proper response (again) much
> appreciated. Thank you a ton!

It's worth thinking twice if you find yourself removing something to add
it back.  Sometimes it's just more convenient, or even useful, because
Coccinelle is pretty good now at inserting newlines in the right place for
long argument lists, but when it is at one end or another of the pattern
like this, it can be better to just pull the common part out into the
context.

julia


More information about the Cocci mailing list