提交 1bdab9e5 编写于 作者: A Andy Whitcroft 提交者: Linus Torvalds

checkpatch: switch indent allow plain return

It is a common and sane idiom to allow a single return on the end of a
case statement:

	switch (...) {
	case foo:	return bar;
	}

Add an exception for this.
Signed-off-by: NAndy Whitcroft <apw@shadowen.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 14b111c1
...@@ -1295,7 +1295,11 @@ sub process { ...@@ -1295,7 +1295,11 @@ sub process {
} }
} }
if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
$line !~ /\G(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$/g) { $line !~ /\G(?:
(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
\s*return\s+
)/xg)
{
ERROR("trailing statements should be on next line\n" . $herecurr); ERROR("trailing statements should be on next line\n" . $herecurr);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册