mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.com>,
	cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] coccinelle: tests: if and else branch should probably not be identical
Date: Sat, 23 Jul 2016 12:46:01 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1607231242420.3304@hadrien> (raw)
In-Reply-To: <20160722190839.GA15538@osadl.at>



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
> > > +
> > > +@cond@
> > > +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

      reply	other threads:[~2016-07-23 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22  9:05 Nicholas Mc Guire
2016-07-22 16:56 ` Julia Lawall
2016-07-22 19:08   ` Nicholas Mc Guire
2016-07-23 10:46     ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1607231242420.3304@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=der.herr@hofr.at \
    --cc=hofrat@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@imag.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®