From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH v2 4/4] checkpatch.pl: check for #if 0/#if 1
Date: Wed, 5 Dec 2018 16:21:58 +0300 [thread overview]
Message-ID: <20181205132158.32337-5-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20181205132158.32337-1-antonynpavlov@gmail.com>
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 <antonynpavlov@gmail.com>
---
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
next prev parent reply other threads:[~2018-12-05 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 13:21 [PATCH v2 0/4] checkpatch.pl: add ability to ignore various messages Antony Pavlov
2018-12-05 13:21 ` [PATCH v2 1/4] " Antony Pavlov
2018-12-05 13:21 ` [PATCH v2 2/4] checkpatch.pl: check for common memset parameter issues against statements Antony Pavlov
2018-12-05 13:21 ` [PATCH v2 3/4] checkpatch.pl: use SPDX tag Antony Pavlov
2018-12-05 13:21 ` Antony Pavlov [this message]
2018-12-05 13:28 ` [PATCH v2 0/4] checkpatch.pl: add ability to ignore various messages Antony Pavlov
2018-12-06 7:57 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181205132158.32337-5-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.