On Sun, 17 Aug 2014, SF Markus Elfring wrote:

> > I don't think so as any type or combination of
> > arithmetic operations would then need to be specified
> > by the spatch input script.
>
> I imagine that it will be occasionally useful to be more specific in
> such semantic patterns.
>
> @pointer_arithmetic@
> identifier var, member, add;
> int num1, num2;
> @@
> - *(var->member + add / num1 + num2)
> + var->member[add / num1 + num2]

I don't see the need to be specific about the division, but it is true
that the associativity of + is annoying: whatever it is, there are always
cases ehere it is not what you want,  You can match things like this with

*(var->member + ...)

but there is no way to pick up on an expression that matches the ..., so
you have tomake special cases.  ON the other hand, you could see what
special cases are needed for your software with the above pattern.

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

Reply via email to