linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Don't warn about colon termination in linker scripts
@ 2021-02-04 16:32 Chris Down
  2021-02-06  3:25 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Down @ 2021-02-04 16:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, kernel-team

This check erroneously flags cases like the one in my recent printk
enumeration patch[0], where the spaces are syntactic, and `section:' vs.
`section :' is syntactically important:

    ERROR: space prohibited before that ':' (ctx:WxW)
    #258: FILE: include/asm-generic/vmlinux.lds.h:314:
    +       .printk_fmts : AT(ADDR(.printk_fmts) - LOAD_OFFSET) {

0: https://lore.kernel.org/patchwork/patch/1375749/

Signed-off-by: Chris Down <chris@chrisdown.name>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4f8494527139..3bcffc5574ae 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5046,7 +5046,7 @@ sub process {
 				# A colon needs no spaces before when it is
 				# terminating a case value or a label.
 				} elsif ($opv eq ':C' || $opv eq ':L') {
-					if ($ctx =~ /Wx./) {
+					if ($ctx =~ /Wx./ and $realfile !~ m@.*\.lds\.h$@) {
 						if (ERROR("SPACING",
 							  "space prohibited before that '$op' $at\n" . $hereptr)) {
 							$good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
-- 
2.30.0


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

* Re: [PATCH] checkpatch: Don't warn about colon termination in linker scripts
  2021-02-04 16:32 [PATCH] checkpatch: Don't warn about colon termination in linker scripts Chris Down
@ 2021-02-06  3:25 ` Joe Perches
  2021-02-06 13:04   ` Chris Down
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2021-02-06  3:25 UTC (permalink / raw)
  To: Chris Down, Andrew Morton; +Cc: linux-mm, linux-kernel, kernel-team

On Thu, 2021-02-04 at 16:32 +0000, Chris Down wrote:
> This check erroneously flags cases like the one in my recent printk
> enumeration patch[0], where the spaces are syntactic, and `section:' vs.
> `section :' is syntactically important:
> 
>     ERROR: space prohibited before that ':' (ctx:WxW)
>     #258: FILE: include/asm-generic/vmlinux.lds.h:314:
>     +       .printk_fmts : AT(ADDR(.printk_fmts) - LOAD_OFFSET) {
> 
> 0: https://lore.kernel.org/patchwork/patch/1375749/

Remember to cc the checkpatch maintainers.

> Signed-off-by: Chris Down <chris@chrisdown.name>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4f8494527139..3bcffc5574ae 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5046,7 +5046,7 @@ sub process {
>  				# A colon needs no spaces before when it is
>  				# terminating a case value or a label.
>  				} elsif ($opv eq ':C' || $opv eq ':L') {
> -					if ($ctx =~ /Wx./) {
> +					if ($ctx =~ /Wx./ and $realfile !~ m@.*\.lds\.h$@) {
>  						if (ERROR("SPACING",
>  							  "space prohibited before that '$op' $at\n" . $hereptr)) {
>  							$good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);



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

* Re: [PATCH] checkpatch: Don't warn about colon termination in linker scripts
  2021-02-06  3:25 ` Joe Perches
@ 2021-02-06 13:04   ` Chris Down
  2021-02-06 13:11     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Down @ 2021-02-06 13:04 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, linux-mm, linux-kernel, kernel-team

Oh, apologies -- I was somehow operating under the mistaken memory that this 
was under Andrew's purview and neglected to run get_maintainer.

I'll resend. :-)

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

* Re: [PATCH] checkpatch: Don't warn about colon termination in linker scripts
  2021-02-06 13:04   ` Chris Down
@ 2021-02-06 13:11     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2021-02-06 13:11 UTC (permalink / raw)
  To: Chris Down; +Cc: Andrew Morton, linux-mm, linux-kernel, kernel-team

On Sat, 2021-02-06 at 13:04 +0000, Chris Down wrote:
> Oh, apologies -- I was somehow operating under the mistaken memory that this 
> was under Andrew's purview and neglected to run get_maintainer.
> 
> I'll resend. :-)

No need really.  The patch is fine.


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

end of thread, other threads:[~2021-02-06 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 16:32 [PATCH] checkpatch: Don't warn about colon termination in linker scripts Chris Down
2021-02-06  3:25 ` Joe Perches
2021-02-06 13:04   ` Chris Down
2021-02-06 13:11     ` Joe Perches

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).