diff mbox series

[PULL,27/74] checkpatch: allow space in more places before a bracket

Message ID 1534870966-9287-28-git-send-email-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/74] tests: virtio: separate ccw tests from libqos | expand

Commit Message

Paolo Bonzini Aug. 21, 2018, 5:01 p.m. UTC
From: Heinrich Schuchardt <xypron.glpk@gmx.de>

Allow a space between a colon and subsequent opening bracket.  This
sequence may occur in inline assembler statements like

	asm(
		"ldr %[out], [%[in]]\n\t"
		: [out] "=r" (ret)
		: [in] "r" (addr)
	);

Allow a space between a comma and subsequent opening bracket.  This
sequence may occur in designated initializers.

To ease backporting the patch, I am also changing the comma-bracket
detection (added in QEMU by commit 409db6eb7199af7a2f09f746bd1b793e9daefe5f)
to use the same regex as brackets and colons (as done independently
by Linux commit daebc534ac15f991961a5bb433e515988220e9bf).

Link: http://lkml.kernel.org/r/20180403191655.23700-1-xypron.glpk@gmx.de
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/checkpatch.pl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Linus Torvalds Aug. 21, 2018, 6:38 p.m. UTC | #1
This is commit 38dca988bb20 ("checkpatch: allow space between colon
and bracket") upstream, why is that not mentioned anywhere?

*Please* mention the upstream commits when back-porting things.

                 Linus


On Tue, Aug 21, 2018 at 10:03 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> Allow a space between a colon and subsequent opening bracket.  This
> sequence may occur in inline assembler statements like
Paolo Bonzini Aug. 22, 2018, 8:56 a.m. UTC | #2
On 21/08/2018 20:38, Linus Torvalds wrote:
> This is commit 38dca988bb20 ("checkpatch: allow space between colon
> and bracket") upstream, why is that not mentioned anywhere?

Trivially because I used "git commit -c" instead of "git cherry-pick" (I
don't remember exactly why, probably I did the patch quickly and only
later noticed that Linux had already fixed the same thing).  I did
mention Linux commit daebc534ac in the commit message, but not 38dca988bb20.

Paolo

> *Please* mention the upstream commits when back-porting things.
> 
>                  Linus
> 
> 
> On Tue, Aug 21, 2018 at 10:03 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>
>> Allow a space between a colon and subsequent opening bracket.  This
>> sequence may occur in inline assembler statements like
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0553634..3765b0e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1929,9 +1929,8 @@  sub process {
 			my ($where, $prefix) = ($-[1], $1);
 			if ($prefix !~ /$Type\s+$/ &&
 			    ($where != 0 || $prefix !~ /^.\s+$/) &&
-			    $prefix !~ /{\s+$/ &&
 			    $prefix !~ /\#\s*define[^(]*\([^)]*\)\s+$/ &&
-			    $prefix !~ /,\s+$/) {
+			    $prefix !~ /[,{:]\s+$/) {
 				ERROR("space prohibited before open square bracket '['\n" . $herecurr);
 			}
 		}