linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: extend line continuation test
       [not found] <20121030211530.09F1320004E@hpza10.eem.corp.google.com>
@ 2012-11-16  6:21 ` Joe Perches
  2012-11-16  6:28   ` Jingoo Han
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joe Perches @ 2012-11-16  6:21 UTC (permalink / raw)
  To: Andrew Morton, Jingoo Han; +Cc: Andy Whitcroft, peter, LKML

Preprocessor directives and asm statements should be
allowed to have a line continuation.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d2d5ba1..019f9be 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3006,10 +3006,12 @@ sub process {
 				}
 			}
 
-# check for line continuations outside of #defines
+# check for line continuations outside of #defines, preprocessor #, and asm
 
 		} else {
 			if ($prevline !~ /^..*\\$/ &&
+			    $line !~ /^\+\s*\#*.*\\$/ &&	# preprocessor
+			    $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ &&	# asm
 			    $line =~ /^\+.*\\$/) {
 				WARN("LINE_CONTINUATIONS",
 				     "Avoid unnecessary line continuations\n" . $herecurr);



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

* Re: [PATCH] checkpatch: extend line continuation test
  2012-11-16  6:21 ` [PATCH] checkpatch: extend line continuation test Joe Perches
@ 2012-11-16  6:28   ` Jingoo Han
  2012-11-16  7:02   ` Geert Uytterhoeven
  2012-11-16 19:31   ` [PATCH V2] " Joe Perches
  2 siblings, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2012-11-16  6:28 UTC (permalink / raw)
  To: 'Joe Perches', 'Andrew Morton'
  Cc: 'Andy Whitcroft', peter, 'LKML', 'Jingoo Han'

On Friday, November 16, 2012 3:21 PM, Joe Perches wrote
> 
> Preprocessor directives and asm statements should be
> allowed to have a line continuation.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Hi Joe Perches,

It works properly. :)

Tested-by: Jingoo Han <jg1.han@samsung.com>


Best regards,
Jingoo Han

> ---
>  scripts/checkpatch.pl |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d2d5ba1..019f9be 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3006,10 +3006,12 @@ sub process {
>  				}
>  			}
> 
> -# check for line continuations outside of #defines
> +# check for line continuations outside of #defines, preprocessor #, and asm
> 
>  		} else {
>  			if ($prevline !~ /^..*\\$/ &&
> +			    $line !~ /^\+\s*\#*.*\\$/ &&	# preprocessor
> +			    $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ &&	# asm
>  			    $line =~ /^\+.*\\$/) {
>  				WARN("LINE_CONTINUATIONS",
>  				     "Avoid unnecessary line continuations\n" . $herecurr);



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

* Re: [PATCH] checkpatch: extend line continuation test
  2012-11-16  6:21 ` [PATCH] checkpatch: extend line continuation test Joe Perches
  2012-11-16  6:28   ` Jingoo Han
@ 2012-11-16  7:02   ` Geert Uytterhoeven
  2012-11-16  7:09     ` Joe Perches
  2012-11-16 19:31   ` [PATCH V2] " Joe Perches
  2 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2012-11-16  7:02 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, Jingoo Han, Andy Whitcroft, peter, LKML

On Fri, Nov 16, 2012 at 7:21 AM, Joe Perches <joe@perches.com> wrote:
> Preprocessor directives and asm statements should be
> allowed to have a line continuation.

For preprocessor directives I agree.

But why do asm statements need it? They'r just strings, so just closing with
a double quote at the end of the first line, and opening again with a
double quote
on the next line works fine.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] checkpatch: extend line continuation test
  2012-11-16  7:02   ` Geert Uytterhoeven
@ 2012-11-16  7:09     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2012-11-16  7:09 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andrew Morton, Jingoo Han, Andy Whitcroft, peter, LKML

On Fri, 2012-11-16 at 08:02 +0100, Geert Uytterhoeven wrote:
> On Fri, Nov 16, 2012 at 7:21 AM, Joe Perches <joe@perches.com> wrote:
> > Preprocessor directives and asm statements should be
> > allowed to have a line continuation.
> 
> For preprocessor directives I agree.
> 
> But why do asm statements need it? They'r just strings, so just closing with
> a double quote at the end of the first line, and opening again with a
> double quote
> on the next line works fine.

I agree it does, but it's a pretty common existing style and
I want to avoid people submitting unnecessary "fix" patches.



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

* [PATCH V2] checkpatch: extend line continuation test
  2012-11-16  6:21 ` [PATCH] checkpatch: extend line continuation test Joe Perches
  2012-11-16  6:28   ` Jingoo Han
  2012-11-16  7:02   ` Geert Uytterhoeven
@ 2012-11-16 19:31   ` Joe Perches
  2012-11-19  1:06     ` Jingoo Han
  2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2012-11-16 19:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jingoo Han, Andy Whitcroft, peter, LKML

Preprocessor directives and asm statements should be
allowed to have a line continuation.

Signed-off-by: Joe Perches <joe@perches.com>
---
V2:
Make the check for preprocessor directives work properly
# is not optional.

 scripts/checkpatch.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d2d5ba1..bfb06ee 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3006,10 +3006,12 @@ sub process {
 				}
 			}
 
-# check for line continuations outside of #defines
+# check for line continuations outside of #defines, preprocessor #, and asm
 
 		} else {
 			if ($prevline !~ /^..*\\$/ &&
+			    $line !~ /^\+\s*\#.*\\$/ &&		# preprocessor
+			    $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ &&	# asm
 			    $line =~ /^\+.*\\$/) {
 				WARN("LINE_CONTINUATIONS",
 				     "Avoid unnecessary line continuations\n" . $herecurr);



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

* Re: [PATCH V2] checkpatch: extend line continuation test
  2012-11-16 19:31   ` [PATCH V2] " Joe Perches
@ 2012-11-19  1:06     ` Jingoo Han
  0 siblings, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2012-11-19  1:06 UTC (permalink / raw)
  To: 'Joe Perches', 'Andrew Morton'
  Cc: 'Andy Whitcroft', peter, 'LKML', 'Jingoo Han'

On Saturday, November 17, 2012 4:31 AM, Joe Perches wrote
> 
> Preprocessor directives and asm statements should be
> allowed to have a line continuation.
> 
> Signed-off-by: Joe Perches <joe@perches.com>


Tested-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han


> ---
> V2:
> Make the check for preprocessor directives work properly
> # is not optional.
> 
>  scripts/checkpatch.pl |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d2d5ba1..bfb06ee 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3006,10 +3006,12 @@ sub process {
>  				}
>  			}
> 
> -# check for line continuations outside of #defines
> +# check for line continuations outside of #defines, preprocessor #, and asm
> 
>  		} else {
>  			if ($prevline !~ /^..*\\$/ &&
> +			    $line !~ /^\+\s*\#.*\\$/ &&		# preprocessor
> +			    $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ &&	# asm
>  			    $line =~ /^\+.*\\$/) {
>  				WARN("LINE_CONTINUATIONS",
>  				     "Avoid unnecessary line continuations\n" . $herecurr);



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

end of thread, other threads:[~2012-11-19  1:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20121030211530.09F1320004E@hpza10.eem.corp.google.com>
2012-11-16  6:21 ` [PATCH] checkpatch: extend line continuation test Joe Perches
2012-11-16  6:28   ` Jingoo Han
2012-11-16  7:02   ` Geert Uytterhoeven
2012-11-16  7:09     ` Joe Perches
2012-11-16 19:31   ` [PATCH V2] " Joe Perches
2012-11-19  1:06     ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).