From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755903AbdJJIpk (ORCPT ); Tue, 10 Oct 2017 04:45:40 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:50804 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755221AbdJJIpi (ORCPT ); Tue, 10 Oct 2017 04:45:38 -0400 From: Jiang Biao To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org, jiang.biao2@zte.com.cn, zhong.weidong@zte.com.cn Subject: [PATCH] scripts/checkpatch.pl: fix false warning of externs checking. Date: Tue, 10 Oct 2017 16:42:50 +0800 Message-Id: <1507624970-4609-1-git-send-email-jiang.biao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-10-10 16:44:58, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-10-10 16:44:51, Serialize complete at 2017-10-10 16:44:51 X-MAIL: mse01.zte.com.cn v9A8itB1016637 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When adding a function declaration in a .c file without an extern keywork decoration, checkpatch.pl will complain *externs should be avoided in .c files* false warning. This patch fix the bug. Signed-off-by: Jiang Biao --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index dd2c262..170daf1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5927,7 +5927,7 @@ sub process { # check for new externs in .c files. if ($realfile =~ /\.c$/ && defined $stat && - $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) + $stat =~ /^.\s*(?:extern\s+)$Type\s+($Ident)(\s*)\(/s) { my $function_name = $1; my $paren_space = $2; -- 2.7.4