Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753985AbcDSTP6 (ORCPT ); Tue, 19 Apr 2016 15:15:58 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:49253 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbcDSTP5 (ORCPT ); Tue, 19 Apr 2016 15:15:57 -0400 X-IronPort-AV: E=Sophos;i="5.24,506,1454972400"; d="scan'208";a="175101912" Date: Tue, 19 Apr 2016 21:15:54 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: Joe Perches cc: cocci , LKML Subject: Re: coccinelle: bool if (foo) return true; else return false; In-Reply-To: <1461093152.1917.26.camel@perches.com> Message-ID: References: <1460828078-5224-1-git-send-email-dave@stgolabs.net> <1460833453.19090.79.camel@perches.com> <1460836099.19090.82.camel@perches.com> <1460881671.19090.90.camel@perches.com> <1460908959.19090.95.camel@perches.com> <1460915801.19090.100.camel@perches.com> <1461093152.1917.26.camel@perches.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1230623393-1461093355=:2054" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 952 Lines: 51 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1230623393-1461093355=:2054 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Tue, 19 Apr 2016, Joe Perches wrote: > There's ~150 of these in the kernel. > > Maybe there's use for this conversion to be added > to?scripts/coccinelle/misc/boolreturn.cocci or in > a separate file. > > $ cat booltruefalse.cocci > @@ > identifier fn; > expression e; > typedef bool; > symbol true; > symbol false; > @@ > > bool fn ( ... ) > { > <... > - if (e) return true; else return false; > + return e; > ...> > } > > @@ > identifier fn; > expression e; > @@ > > bool fn ( ... ) > { > <... > - if (e) return false; else return true; > + return !e; > ...> > } Thanks for the suggestion. I will take care of it shortly. julia --8323328-1230623393-1461093355=:2054--