On Fri, 29 Oct 2010, Nicolas Palix wrote:
> On Fri, Oct 29, 2010 at 3:24 PM, Julia Lawall <[email protected]> wrote:
> > On Thu, 28 Oct 2010, Andi Kleen wrote:
> >
> >> > > How to express that in smpl?
> >> >
> >> > ... when != S
> >> > {Some statement}
> >> >
> >> > where S is a statement metavariable. {Some statement} might also be
> >> > another statement metavariable if you don't know what kind of statement
> >> > to
> >> > expect. There is probably some more complicated way of dealing with
> >> > functions that only have declarations and no following statement, but I
> >> > guess that would be quite rare.
> >>
> >> Thanks Julia. That worked, except that it skipped the empty line
> >> after the declarations too, so I ended up with
> >>
> >> foo()
> >> {
> >> int x;
> >> <--- empty line
> >> int y; <--- my new statement
> >>
> >> But I guess that can be manually removed or is there a way to tell this
> >> cocci too?
> >
> > The following should work, but it does not. It attaches to each
> > declaration. I think it is optimising too much the S. I will take a look
> > later today.
>
> I think it is the missing use of r.p in the code part.
Oops!!! Thanks :)
julia
> > @r@
> > declaration D;
> > statement S;
> > identifier f;
> > position p;
> > @@
> >
> > f(...) {
> > ... when any
> > �...@p
> > S
> > ... when any
> > }
> >
> > @@
> > declaration D;
> > position r.p;
> > @@
> >
> > D
>
> d...@p
>
> > + int a;
> >
> > julia
> > _______________________________________________
> > Cocci mailing list
> > [email protected]
> > http://lists.diku.dk/mailman/listinfo/cocci
> > (Web access from inside DIKUs LAN only)
> >
>
>
>
> --
> Nicolas Palix
> Tel: +33 6 81 07 91 72
> _______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)