From: joe@perches.com (Joe Perches) Date: Tue, 01 Apr 2014 22:57:41 -0700 Subject: [Cocci] coccinelle: trivial linux code style reformatting In-Reply-To: References: <1396374174.21529.93.camel@joe-AO722> <1396393876.21529.99.camel@joe-AO722> Message-ID: <1396418261.32040.1.camel@joe-AO722> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr On Wed, 2014-04-02 at 07:53 +0200, Julia Lawall wrote: > On Tue, 1 Apr 2014, Joe Perches wrote: > > On Tue, 2014-04-01 at 20:29 +0200, Peter Senna Tschudin wrote: > > > I changed the first rule to: > > > > > > @@ > > > identifier func; > > > expression S,E; > > > @@ > > > void func(...) { > > > ... > > > - if (E) return S; > > > + if (E) {S; return;} > > > > Thanks Peter, that makes more sense than > > what I wrote. > > I don't think it makes any more sense. Indeed, it works mostly better, > because Coccinelle takes charge of the interaction between the ) and the > {, but if ther is some specific spacing in E, that will be lost. I think > that version rc20 should have handled the original rule correctly. I will > look into it. Thanks. > On the other hand, I didn't understand the second rule, It's broken. > > @@ > > identifier func; > > expression S; > > @@ > > void func(...) { > > ... > > if (...) { > > ... > > - return S; > > + S; > > } > > ... > > } > > at all. Should it be + S; return;? Yes, true, just like the first case.