All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged] checkpatch-allow-fix-removal-of-unnecessary-break-statements.patch removed from -mm tree
@ 2020-12-16 17:09 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-16 17:09 UTC (permalink / raw)
  To: joe, julia.lawall, mm-commits, trix


The patch titled
     Subject: checkpatch: allow --fix removal of unnecessary break statements
has been removed from the -mm tree.  Its filename was
     checkpatch-allow-fix-removal-of-unnecessary-break-statements.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: allow --fix removal of unnecessary break statements

switch/case use of break after a return, goto or break is unnecessary.

There is an existing warning for the return and goto uses, so add
break and a --fix option too.

Link: https://lkml.kernel.org/r/d9ea654104d55f590fb97d252d64a66b23c1a096.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Tom Rix <trix@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 scripts/checkpatch.pl |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/scripts/checkpatch.pl~checkpatch-allow-fix-removal-of-unnecessary-break-statements
+++ a/scripts/checkpatch.pl
@@ -3699,12 +3699,16 @@ sub process {
 		}
 
 # check indentation of a line with a break;
-# if the previous line is a goto or return and is indented the same # of tabs
+# if the previous line is a goto, return or break
+# and is indented the same # of tabs
 		if ($sline =~ /^\+([\t]+)break\s*;\s*$/) {
 			my $tabs = $1;
-			if ($prevline =~ /^\+$tabs(?:goto|return)\b/) {
-				WARN("UNNECESSARY_BREAK",
-				     "break is not useful after a goto or return\n" . $hereprev);
+			if ($prevline =~ /^\+$tabs(goto|return|break)\b/) {
+				if (WARN("UNNECESSARY_BREAK",
+					 "break is not useful after a $1\n" . $hereprev) &&
+				    $fix) {
+					fix_delete_line($fixlinenr, $rawline);
+				}
 			}
 		}
 
_

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:[~2020-12-16 17:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 17:09 [merged] checkpatch-allow-fix-removal-of-unnecessary-break-statements.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.