checkpatch: Allow space before [ in the case of inline asm

This allows the customary syntax for declaring named arguments,
such as:

asm ("mov %[out],%[in]" : [out] "=r" (x) : [in] "r" (y));

Since :[ is comple-error-inducingly invalid syntax in other cases,
this won't create unintentional leniency for normal uses of [

Originally from https://lkml.org/lkml/2010/11/16/145 by Dave Martin

Change-Id: Iead3fdb147ba2f6cbd108f19dd348bb72a7e6b6f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2015-11-06 18:23:35 -05:00
parent 2fced15758
commit 98c50de9ff

View file

@ -3695,7 +3695,8 @@ sub process {
my ($where, $prefix) = ($-[1], $1); my ($where, $prefix) = ($-[1], $1);
if ($prefix !~ /$Type\s+$/ && if ($prefix !~ /$Type\s+$/ &&
($where != 0 || $prefix !~ /^.\s+$/) && ($where != 0 || $prefix !~ /^.\s+$/) &&
$prefix !~ /[{,]\s+$/) { $prefix !~ /[{,]\s+$/ &&
$prefix !~ /:\s+$/) {
if (ERROR("BRACKET_SPACE", if (ERROR("BRACKET_SPACE",
"space prohibited before open square bracket '['\n" . $herecurr) && "space prohibited before open square bracket '['\n" . $herecurr) &&
$fix) { $fix) {