From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbcGWKqH (ORCPT ); Sat, 23 Jul 2016 06:46:07 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:58088 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137AbcGWKqE (ORCPT ); Sat, 23 Jul 2016 06:46:04 -0400 X-IronPort-AV: E=Sophos;i="5.28,408,1464645600"; d="scan'208";a="227692344" Date: Sat, 23 Jul 2016 12:46:01 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Nicholas Mc Guire cc: Nicholas Mc Guire , Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] coccinelle: tests: if and else branch should probably not be identical In-Reply-To: <20160722190839.GA15538@osadl.at> Message-ID: References: <1469178343-29192-1-git-send-email-hofrat@osadl.org> <20160722190839.GA15538@osadl.at> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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