devtools: fix check of variable declaration inside for

An expression with a space is split by the awk script resulting in
false positive for any patch matching any of the two part of the
expression.
Fix this by using [[:space:]].

Fixes: 43e73483a4 ("devtools: forbid variable declaration inside for")

Signed-off-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
David Marchand 2020-07-06 10:00:22 +02:00 committed by Thomas Monjalon
parent 8d4a222e12
commit 4c4f839446

View File

@ -71,7 +71,7 @@ check_forbidden_additions() { # <patch>
# forbid variable declaration inside "for" loop
awk -v FOLDERS='.' \
-v EXPRESSIONS='for *\\((char|u?int|unsigned|s?size_t)' \
-v EXPRESSIONS='for[[:space:]]*\\((char|u?int|unsigned|s?size_t)' \
-v RET_ON_FAIL=1 \
-v MESSAGE='Declaring a variable inside for()' \
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \