Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1423796imm; Wed, 25 Jul 2018 18:28:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdEjB3Mtwt7qgDV03E5FOJuGO/wKWOCRhOD2f4lxi6rg1V3sjnNrtApm+xed3sguD57imvd X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr24300877pfk.72.1532568489966; Wed, 25 Jul 2018 18:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532568489; cv=none; d=google.com; s=arc-20160816; b=SdfHQeJkimF6HS4cNmUY2otbL/wKBgqe4XRIGWqFOYsGjrPzLp0CCG9/vQtuHOoU/f Fc5vK4q19vR0jCTjys03BX4yBrtjFaxPWtkLZqtLFKiHHU3XuduREANYXNAqgQYD9/K5 NTGHDLFs+rBxkq4Pkt9XMaHK/Ane362hpuQDTnMmRDKPliag7e68f4x/2UU+yef8UoDK LFegatayzIRpyX5RdiGGz2JJ3uqAnjW7sDYvUlqxYO1M4jPia4mGCGSZRJxU8Ib5YdKW I3r75NsuwYl+YDE8xCnYr+hY0YpGP8dBjcMPHPqcR3MzVHMjXljdsf4lOsZpJySmt1bJ GlnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=x8OO2G0OWup13ydyO6dmaZ5iu3Z3mQulFV9pGyN9iEU=; b=OC/iuUJPpjWOuNL6GIHuyX+/72XhnrBtVpaPw0bld1cTxwP7BGL1rnUoWGRADt+ZDj ysM0kq7WtM0UK2BTAk8BuV7J6INloqPU3rQh8NKn48P8L+TE7ESnCnFoFXBrkz2x6Bid ZXBNhIy+P6PTV8a+6QyiYoqYrLwbn7KbmbnknPua98InEcwDWGyaHP/hZ0o6M8ScCVFz nt3zn2w7ZITm7on8auQQp+HOhSEw++NFHd4Axd5wBkz/ZJLwGV4SPE0RzeSS5gnlYf6P 2py+HO9zV7A2w7EaGohILsP6HGCglQllGse7eytZsPjeFlfOQNxQHJ5h0p7dcMt/AzmY 9FWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14-v6si14864322pgc.368.2018.07.25.18.27.53; Wed, 25 Jul 2018 18:28:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728619AbeGZClY (ORCPT + 99 others); Wed, 25 Jul 2018 22:41:24 -0400 Received: from smtprelay0210.hostedemail.com ([216.40.44.210]:46443 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728523AbeGZClY (ORCPT ); Wed, 25 Jul 2018 22:41:24 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id C893118021DA9; Thu, 26 Jul 2018 01:27:02 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3870:3871:3872:3874:4321:5007:7875:8604:9393:10004:10400:10848:11232:11658:11914:12555:12740:12760:12895:13069:13095:13161:13229:13311:13357:13439:14181:14659:14721:21060:21063:21080:21433:21451:21627:30012:30054:30070:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: mine37_3d5a5cb248031 X-Filterd-Recvd-Size: 2394 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA; Thu, 26 Jul 2018 01:27:01 +0000 (UTC) Message-ID: <2a56b48632fe8982735769b52aafe721b29b1bcf.camel@perches.com> Subject: Re: [PATCH v1] checkpatch: check for #if 0/#if 1 From: Joe Perches To: Prakruthi Deepak Heragu , apw@canonical.com Cc: linux-kernel@vger.kernel.org, ckadabi@codeaurora.org, tsoni@codeaurora.org, bryanh@codeaurora.org, Abhijeet Dharmapurikar Date: Wed, 25 Jul 2018 18:27:00 -0700 In-Reply-To: <1532560446-15827-1-git-send-email-pheragu@codeaurora.org> References: <1532560446-15827-1-git-send-email-pheragu@codeaurora.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-07-25 at 16:14 -0700, Prakruthi Deepak Heragu wrote: > The #if 0 or #if 1 is used to toggle features. Warn if #if 0 or #if 1 > is present and suggest that they can be removed. > > Signed-off-by: Abhijeet Dharmapurikar > Signed-off-by: Prakruthi Deepak Heragu > --- > Changes in v1: > - Rephrase the warning message to fit in a single line without > 80 column limit > > scripts/checkpatch.pl | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 3394ed8..72513c2 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -5383,9 +5383,14 @@ sub process { > > # warn about #if 0 > if ($line =~ /^.\s*\#\s*if\s+0\b/) { > - CHK("REDUNDANT_CODE", > - "if this code is redundant consider removing it\n" . > - $herecurr); > + WARN("IF_0", > + "Consider removing the #if 0 and its #endif\n". $herecurr); No, this wording is not correct at all. The entire block, i.e.: 'this code' should be considered to be removed, not just the #if 0 and its #endif. For #if 1 code, then just the #if 1 and the #endif should be removed. > + } > + > +# warn about #if 1 > + if ($line =~ /^.\s*\#\s*if\s+1\b/) { > + WARN("IF_1", > + "Consider removing the #if 1 and its #endif\n". $herecurr); > } > > # check for needless "if () fn()" uses