Whamcloud - gitweb
LU-6142 build: ignore deleted lines for comment context 43/53543/3
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 23 Dec 2023 01:24:18 +0000 (18:24 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 10 Jan 2024 07:28:05 +0000 (07:28 +0000)
checkpatch should skip removed lines when checking comments context.
Otherwise, false "WARNING: memory barrier without comment" and other
messages can be reported when a comment exists on the previous line
but is hidden by the removed 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)

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ib0cd11e66a5b6a3c4505222eb89ff6479246023a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53543
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
contrib/scripts/checkpatch.pl

index 00bf11e..5f09cd1 100755 (executable)
@@ -1570,6 +1570,7 @@ sub ctx_locate_comment {
        for (my $linenr = $first_line; $linenr < $end_line; $linenr++) {
                my $line = $rawlines[$linenr - 1];
                #warn "           $line\n";
+               next if ($line =~ /^-/); # ignore lines removed by patch
                if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
                        $in_comment = 1;
                }