From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUWyU-0007TY-Uv for barebox@lists.infradead.org; Wed, 05 Dec 2018 13:12:33 +0000 Received: by mail-lj1-x243.google.com with SMTP id t9-v6so18259983ljh.6 for ; Wed, 05 Dec 2018 05:12:11 -0800 (PST) From: Antony Pavlov Date: Wed, 5 Dec 2018 16:11:44 +0300 Message-Id: <20181205131144.31512-5-antonynpavlov@gmail.com> In-Reply-To: <20181205131144.31512-1-antonynpavlov@gmail.com> References: <20181205131144.31512-1-antonynpavlov@gmail.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 4/4] checkpatch.pl: check for #if 0/#if 1 To: barebox@lists.infradead.org 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. Based on 60f890105547f7a4 ("checkpatch: check for #if 0/#if 1") Linux kernel commit. Signed-off-by: Antony Pavlov --- scripts/checkpatch.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d1fe6659ce..4e17347a84 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2863,9 +2863,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 code enclosed by this #if 0 and its #endif\n" . $herecurr); + } + +# 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 kfree() checks -- 2.20.0.rc2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox