From 4c4f83944683eca973d5fc5df76cd6199a090e5f Mon Sep 17 00:00:00 2001 From: David Marchand Date: Mon, 6 Jul 2020 10:00:22 +0200 Subject: [PATCH] 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: 43e73483a4b8 ("devtools: forbid variable declaration inside for") Signed-off-by: David Marchand --- devtools/checkpatches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 27ab1252b7..58021aa5dd 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -71,7 +71,7 @@ check_forbidden_additions() { # # 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 \ -- 2.20.1