On 08/17/2014 07:42 PM, Julia Lawall wrote:
On Sun, 17 Aug 2014, Joe Perches wrote:
On Sun, 2014-08-17 at 18:09 +0200, SF Markus Elfring wrote:
I would prefer to be able to convert
*(skb->data + frame_size / 2 + 10)
not to
(skb->data + frame_size / 2)[10]
but to
skb->data[frame_size / 2 + 10]
but I don't know how.
How do you think about a bit more fine-tuning for the desired semantic
patch?
Not sure I understand what you are requesting.
Can it be that the pattern "*(foo + e)" is too generic for any source
code place?
I don't think so as any type or combination of
arithmetic operations would then need to be specified
by the spatch input script.
Would you like to try out the specification of a few more elements
instead of a single expression here?
Not really.
I think a precedence specification capability like first
pointer match followed by longest arithmetic match would
perhaps be a better generic facility.
Isn't the problem already solved? If not, I will look into it.
I think for these kinds of problems it would be helpful to have a
metavariable type that is somewhere in the middle of idexpression and
expression. Something that matches an identifier or accessing a field in an
identifier, or a field of a field of an identifier and so on.
In the past I had cocci scripts where I ended up doing
(
id->fld1
|
id->fld1.fld2
|
id->fld1.fld2.fld3
...
)
to kind of make this work.
- Lars
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci