[sheepdog] [PATCH] checkpatch: fix a false warning

Liu Yuan namei.unix at gmail.com
Sun Dec 1 11:08:50 CET 2013


 /* one liner */
...
some stuff
...
 * blabla
 * blabla
 */

Above is a valid comment, but current check will warn falsely

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 script/checkpatch.pl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/script/checkpatch.pl b/script/checkpatch.pl
index c57380b..520a5db 100755
--- a/script/checkpatch.pl
+++ b/script/checkpatch.pl
@@ -1734,8 +1734,8 @@ sub process {
 				     "[BCS] don't use block comments for one liner comment\n" . $hereprev);
 			} else {
 				# case E
-				my $ln = $linenr;
-				while ($rawlines[$ln] !~ /^\+\s*\/\*/ && $ln >= 0) { $ln--; }
+				my $ln = $linenr - 1;
+				while ($rawlines[$ln] =~ /^\+/ && $rawlines[$ln] !~ /^\+\s*\/\*/ && $ln >= 0) { $ln--; }
 				if ($rawlines[$ln] =~ /^\+\s*\/\*./) {
 					WARN("BLOCK_COMMENT_STYLE",
 					     "[BCS] don't comment at first line in block comments\n" . $hereprev);
-- 
1.7.9.5




More information about the sheepdog mailing list