Messages in this thread | | | Date | Wed, 1 Apr 2020 08:38:24 -0700 | From | "Paul E. McKenney" <> | Subject | Re: [PATCH] checkpatch: Warn about data_race() without comment |
| |
On Wed, Apr 01, 2020 at 08:17:52AM -0700, Joe Perches wrote: > On Wed, 2020-04-01 at 12:17 +0200, Marco Elver wrote: > > Warn about applications of data_race() without a comment, to encourage > > documenting the reasoning behind why it was deemed safe. > [] > > diff --git 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", > > Sensible enough but it looks like ctx_has_comment should > be updated to allow c99 comments too, but that should be > a separate change from this patch. > > Otherwise, this style emits a message: > > WARNING: data_race without comment > #135: FILE: kernel/rcu/tasks.h:135: > + int i = data_race(rtp->gp_state); // Let KCSAN detect update races >
Yes, please!
Thanx, Paul
| |