From fdb7dbadd869f5b6ec46d868e78c12e321a01fb5 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 22 Dec 2023 18:24:18 -0700 Subject: [PATCH] LU-6142 build: ignore deleted lines for comment context 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 Change-Id: Ib0cd11e66a5b6a3c4505222eb89ff6479246023a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53543 Reviewed-by: Oleg Drokin Reviewed-by: Arshad Hussain Reviewed-by: Timothy Day Tested-by: jenkins Tested-by: Maloo --- contrib/scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index 00bf11e..5f09cd1 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -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; } -- 1.8.3.1