From: Marco Elver <elver@google.com>
To: elver@google.com
Cc: paulmck@kernel.org, dvyukov@google.com, glider@google.com,
andreyknvl@google.com, kasan-dev@googlegroups.com,
linux-kernel@vger.kernel.org, apw@canonical.com, joe@perches.com,
Will Deacon <will@kernel.org>
Subject: [PATCH] checkpatch: Warn about data_race() without comment
Date: Wed, 1 Apr 2020 12:17:14 +0200 [thread overview]
Message-ID: <20200401101714.44781-1-elver@google.com> (raw)
Warn about applications of data_race() without a comment, to encourage
documenting the reasoning behind why it was deemed safe.
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Marco Elver <elver@google.com>
---
scripts/checkpatch.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a63380c6b0d2..48bb9508e300 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5833,6 +5833,14 @@ sub process {
}
}
+# check for data_race without a comment.
+ if ($line =~ /\bdata_race\s*\(/) {
+ if (!ctx_has_comment($first_line, $linenr)) {
+ WARN("DATA_RACE",
+ "data_race without comment\n" . $herecurr);
+ }
+ }
+
# check for smp_read_barrier_depends and read_barrier_depends
if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
WARN("READ_BARRIER_DEPENDS",
--
2.26.0.rc2.310.g2932bb562d-goog
next reply other threads:[~2020-04-01 10:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 10:17 Marco Elver [this message]
2020-04-01 10:32 ` [PATCH] checkpatch: Warn about data_race() without comment Will Deacon
2020-04-01 15:17 ` Joe Perches
2020-04-01 15:38 ` Paul E. McKenney
2020-04-02 2:20 ` [PATCH] checkpatch: Look for c99 comments in ctx_locate_comment Joe Perches
2020-04-02 3:12 ` Paul E. McKenney
2020-04-16 9:27 ` [PATCH] checkpatch: Warn about data_race() without comment Marco Elver
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=20200401101714.44781-1-elver@google.com \
--to=elver@google.com \
--cc=andreyknvl@google.com \
--cc=apw@canonical.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=joe@perches.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).