Skip to content

Commit

Permalink
checkpatch: allow space in more places before a bracket
Browse files Browse the repository at this point in the history
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 409db6e)
to use the same regex as brackets and colons (as done independently
by Linux commit daebc534ac15f991961a5bb433e515988220e9bf).

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Heinrich Schuchardt <[email protected]>
Acked-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
xypron authored and bonzini committed Aug 23, 2018
1 parent 97bfafe commit 66e9d20
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 66e9d20

Please sign in to comment.