[sheepdog] [PATCH 1/2] checkpatch.pl: forbid empty lines after break; line

Hitoshi Mitake h.mitake at gmail.com
Thu Jan 17 17:56:11 CET 2013


This patch lets checkpatch.pl forbid empty lines after break; line.

For example, a patch which contains

+	break;
+

like this causes an error.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 script/checkpatch.pl |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/script/checkpatch.pl b/script/checkpatch.pl
index d33c18f..e8bb542 100755
--- a/script/checkpatch.pl
+++ b/script/checkpatch.pl
@@ -2853,9 +2853,19 @@ sub process {
 			}
 		}
 
+# forbid bzero()
 		if ($line =~ /\bbzero\(/) {
 			ERROR("BZERO", "bzero() is obsolete, use memset()" . $herecurr);
 		}
+
+# forbid empty lines after break; line
+# e.g.
+# +        break;
+# +
+		if ($line =~ /\bbreak;/ && $lines[$linenr] =~ /^\+$/) {
+			ERROR("NL_AFTER_BREAK",
+			      "don't insert empty lines after break; line" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
1.7.5.1




More information about the sheepdog mailing list