Commit 66e9d20e authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Paolo Bonzini

checkpatch: allow space in more places before a bracket

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 409db6eb)
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.deSigned-off-by: 's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: 's avatarJoe Perches <joe@perches.com>
Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: 's avatarMarkus Armbruster <armbru@redhat.com>
Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
parent 97bfafe2
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment