* [Qemu-devel] [PATCH correct] checkpatch: allow space in more places before a bracket
@ 2018-08-17 10:51 Paolo Bonzini
2018-08-17 13:09 ` Markus Armbruster
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2018-08-17 10:51 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson
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>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/checkpatch.pl | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 52ab18bfce..33b5771120 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1977,9 +1977,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);
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH correct] checkpatch: allow space in more places before a bracket
2018-08-17 10:51 [Qemu-devel] [PATCH correct] checkpatch: allow space in more places before a bracket Paolo Bonzini
@ 2018-08-17 13:09 ` Markus Armbruster
0 siblings, 0 replies; 2+ messages in thread
From: Markus Armbruster @ 2018-08-17 13:09 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, richard.henderson
Paolo Bonzini <pbonzini@redhat.com> writes:
> 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>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scripts/checkpatch.pl | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 52ab18bfce..33b5771120 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1977,9 +1977,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);
> }
> }
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-17 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 10:51 [Qemu-devel] [PATCH correct] checkpatch: allow space in more places before a bracket Paolo Bonzini
2018-08-17 13:09 ` Markus Armbruster
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).