[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1507693327-8854-1-git-send-email-jiang.biao2@zte.com.cn>
Date: Wed, 11 Oct 2017 11:42:07 +0800
From: Jiang Biao <jiang.biao2@....com.cn>
To: apw@...onical.com, joe@...ches.com
Cc: linux-kernel@...r.kernel.org, jiang.biao2@....com.cn,
zhong.weidong@....com.cn
Subject: [PATCH] checkpatch: statement should end at a close brace at the outermost level.
Statement should end at a close brace at the outermost level in
ctx_statement_block.
The way to reproduce the bug,
1, Add two external function declarations into line 505 of
kernel/stop_machine.c, such as,
int foo1(void);
int foo2(void);
2, Format a patch for that, and use the checkpatch.pl to check.
3, The first declaration(foo1()) would not be warned, because the
statement does not end at the '}' before it.
Signed-off-by: Jiang Biao <jiang.biao2@....com.cn>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd2c262..f220cfc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1330,7 +1330,7 @@ sub ctx_statement_block {
# Statement ends at the ';' or a close '}' at the
# outermost level.
- if ($level == 0 && $c eq ';') {
+ if ($level == 0 && ($c eq ';' || $c eq '}')) {
last;
}
--
2.7.4
Powered by blists - more mailing lists