From: Joe Perches <joe@perches.com>
To: Andreas Dilger <adilger@whamcloud.com>,
Andy Whitcroft <apw@canonical.com>
Cc: linux-kernel@vger.kernel.org, Andreas Dilger <adilger@dilger.ca>
Subject: Re: [PATCH] checkpatch: ignore deleted lines for comment context
Date: Fri, 22 Dec 2023 15:15:52 -0800 [thread overview]
Message-ID: <2b294dc33ea64d1d605cf146741d92677b13006a.camel@perches.com> (raw)
In-Reply-To: <20231222230551.95425-1-adilger@whamcloud.com>
On Fri, 2023-12-22 at 16:05 -0700, Andreas Dilger wrote:
> From: Andreas Dilger <adilger@dilger.ca>
>
> Don't consider lines being removed by a patch as part of a comment.
> Otherwise, false "WARNING: memory barrier without comment" and similar
> issues can be reported when a comment does exist on the previous line.
>
> For example, a change like below was previously incorrectly flagged:
>
> /* matched by smp_store_release() in some_function() */
> - if (smp_load_acquire(&list->tail) == head))
> + if (smp_load_acquire(&list->tail) == head) && flags == 0)
>
> Signed-off-by: Andreas Dilger <adilger@dilger.ca>
OK, but:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -1972,7 +1972,8 @@ sub ctx_locate_comment {
> $current_comment = '';
> for (my $linenr = $first_line; $linenr < $end_line; $linenr++) {
> my $line = $rawlines[$linenr - 1];
> - #warn " $line\n";
> + #warn "LINE($linenr): $line\n";
This is a superfluous change
> + next if ($line =~ /^-/); # ignore lines removed by patch
> if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
> $in_comment = 1;
> }
next prev parent reply other threads:[~2023-12-22 23:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 23:05 Andreas Dilger
2023-12-22 23:15 ` Joe Perches [this message]
2023-12-22 23:22 ` Andreas Dilger
2025-07-17 1:11 Andreas Dilger
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=2b294dc33ea64d1d605cf146741d92677b13006a.camel@perches.com \
--to=joe@perches.com \
--cc=adilger@dilger.ca \
--cc=adilger@whamcloud.com \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®