public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/checkpatch.pl: fix false warning of externs checking.
@ 2017-10-10  8:42 Jiang Biao
  2017-10-10  8:54 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Jiang Biao @ 2017-10-10  8:42 UTC (permalink / raw)
  To: apw, joe; +Cc: linux-kernel, jiang.biao2, zhong.weidong

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 <jiang.biao2@zte.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..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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts/checkpatch.pl: fix false warning of externs checking.
  2017-10-10  8:42 [PATCH] scripts/checkpatch.pl: fix false warning of externs checking Jiang Biao
@ 2017-10-10  8:54 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-10-10  8:54 UTC (permalink / raw)
  To: Jiang Biao, apw; +Cc: linux-kernel, zhong.weidong

On Tue, 2017-10-10 at 16:42 +0800, Jiang Biao wrote:
> 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.

nack.

The point is that external function declarations should be
done via #include.

> Signed-off-by: Jiang Biao <jiang.biao2@zte.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..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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-10  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10  8:42 [PATCH] scripts/checkpatch.pl: fix false warning of externs checking Jiang Biao
2017-10-10  8:54 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox