[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1607231242420.3304@hadrien>
Date: Sat, 23 Jul 2016 12:46:01 +0200 (CEST)
From: Julia Lawall <julia.lawall@...6.fr>
To: Nicholas Mc Guire <der.herr@...r.at>
cc: Nicholas Mc Guire <hofrat@...dl.org>,
Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <mmarek@...e.com>, cocci@...teme.lip6.fr,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC] coccinelle: tests: if and else branch should probably
not be identical
On Fri, 22 Jul 2016, Nicholas Mc Guire wrote:
> On Fri, Jul 22, 2016 at 06:56:47PM +0200, Julia Lawall wrote:
> > > +virtual context
> > > +virtual org
> > > +virtual report
> > > +
> > > +@...d@
> > > +statement S1;
> > > +position p;
> > > +@@
> > > +
> > > +<+...
> > > +* if@p (...) S1 else S1
> > > +...+>
> >
> > You don't need the <+... ...+>. Just put the if by itself.
> >
>
> will drop that then - though those would be needed for the cases that
> do this recursively. Will fix it and resend.
Sorry, I don't get your point about recursiveness at all. Even if you
have bizarrely
if (e1)
if (e2) S else S
else
if (e2) S else S
the version without <+... ...+> will still work, finding three matches.
The <+... ...+> starts the matching process at the beginning of the
function and ends it at the end of the function, instead of just working
on each if one by one. Thus <+... ...+> should be much less efficient.
Also with <+... ...+> if you put a position variable on eg the if, you
will get a single position array with all the matches, whereas without it
you get one position array per if. The latter is probably easier to
manage.
julia
Powered by blists - more mailing lists