From 98c50de9ff1368136f4b29f38869b420d28d17ab Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 6 Nov 2015 18:23:35 -0500 Subject: [PATCH] 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 --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 976842915f..0b72b8d2dd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3695,7 +3695,8 @@ sub process { my ($where, $prefix) = ($-[1], $1); if ($prefix !~ /$Type\s+$/ && ($where != 0 || $prefix !~ /^.\s+$/) && - $prefix !~ /[{,]\s+$/) { + $prefix !~ /[{,]\s+$/ && + $prefix !~ /:\s+$/) { if (ERROR("BRACKET_SPACE", "space prohibited before open square bracket '['\n" . $herecurr) && $fix) {