* [merged] checkpatch-improve-the-indented-label-test.patch removed from -mm tree
@ 2021-07-06 19:22 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-07-06 19:22 UTC (permalink / raw)
To: elder, gregkh, joe, manikishanghantasala, mm-commits
The patch titled
Subject: checkpatch: improve the indented label test
has been removed from the -mm tree. Its filename was
checkpatch-improve-the-indented-label-test.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: improve the indented label test
checkpatch identifies a label only when a terminating colon
immediately follows an identifier.
Bitfield definitions can appear to be labels so ignore any
spaces between the identifier terminating colon and any digit
that may be used to define a bitfield length.
Miscellanea:
o Improve the initial checkpatch comment
o Use the more typical '&&' instead of 'and'
o Require the initial label character to be a non-digit
(Can't use $Ident here because $Ident allows ## concatenation)
o Use $sline instead of $line to ignore comments
o Use '$sline !~ /.../' instead of '!($line =~ /.../)'
Link: https://lkml.kernel.org/r/b54d673e7cde7de5de0c9ba4dd57dd0858580ca4.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Manikishan Ghantasala <manikishanghantasala@gmail.com>
Cc: Alex Elder <elder@ieee.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
scripts/checkpatch.pl | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/scripts/checkpatch.pl~checkpatch-improve-the-indented-label-test
+++ a/scripts/checkpatch.pl
@@ -5361,9 +5361,13 @@ sub process {
}
}
-#goto labels aren't indented, allow a single space however
- if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
- !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
+# check that goto labels aren't indented (allow a single space indentation)
+# and ignore bitfield definitions like foo:1
+# Strictly, labels can have whitespace after the identifier and before the :
+# but this is not allowed here as many ?: uses would appear to be labels
+ if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
+ $sline !~ /^. [A-Za-z\d_][A-Za-z\d_]*:/ &&
+ $sline !~ /^.\s+default:/) {
if (WARN("INDENTED_LABEL",
"labels should not be indented\n" . $herecurr) &&
$fix) {
_
Patches currently in -mm which might be from joe@perches.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-06 19:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 19:22 [merged] checkpatch-improve-the-indented-label-test.patch removed from -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.