[Cocci] Re: problems with typecasts
Julia Lawall
julia at diku.dk
Thu Mar 5 17:39:22 CET 2009
> > If you really want to combine them,
> > you could say:
> >
> >
> > (
> > read
> > |
> > write
> > )
> > (...,
> > - (T)
> > b)
> >
> > (Note that there is a space before the ( in the sixth line)
> >
>
> Unfortunately, that semantic patch does not match any code with read
> because read only takes one parameter and the pattern has a comma. If I
> remove the comma from the pattern, spatch complains about invalid syntax.
Did you try it? Normally ..., matches no arguments as well. I tried:
@@
identifier f;
expression x;
@@
f(...,
- x
+ 12
)
and
int main () {
f(1,2,3);
f(x);
}
and it updated both calls.
> > For the problem with parentheses, a possibility is to do the following,
> > etc for the read case:
> >
> > - a = *(b)
> > + a = readb(b)
> >
>
> Unfortunately, that won't work match the statement below because there
> are no parentheses around b.
> id2 = *(volatile uint8_t *)(bios + 0x01);
This seems to work fine as well. Again, the isomorphism ensures that *(b)
matches *b also.
julia
More information about the Cocci
mailing list