Skip to contentSkip to conversation

devtools: fix filename in forbidden token check

PATCH Applied David Marchand 3 participants 4 messages Jul 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 devtools: fix filename in forbidden token check

Fix displayed filename by adjusting the extraction from the patch.

Before:
Warning in /lib/librte_eal/linux/eal.c:

After:
Warning in lib/librte_eal/linux/eal.c:

Fixes 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")
---
 devtools/check-forbidden-tokens.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/check-forbidden-tokens.awk +1 -1
index 8c89de3d4e..f86cbe8dc1 100755
@@ -62,7 +62,7 @@ BEGIN {
 }
 END {
 	if (count > 0) {
-		print "Warning in " substr(last_file,6) ":"
+		print "Warning in " substr(last_file,7) ":"
 		print MESSAGE
 		exit RET_ON_FAIL
 	}
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/2 devtools: fix forbidden token

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")
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +1 -1
index 27ab1252b7..58021aa5dd 100755
@@ -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 \
Signature · 1 line
2.23.0
#2 lore raw

Re: [dpdk-dev] [PATCH 2/2] devtools: fix forbidden token

06/07/2020 10:00, David Marchand:

Quoted 8 lines

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")

Applied, thanks

Acked-by on v1 1/2
#3 lore raw
In reply to David Marchand
Quoted 31 lines · David Marchand

Fix displayed filename by adjusting the extraction from the patch.

Before:
Warning in /lib/librte_eal/linux/eal.c:

After:
Warning in lib/librte_eal/linux/eal.c:

Fixes 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")
---
 devtools/check-forbidden-tokens.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/check-forbidden-tokens.awk +1 -2
index 8c89de3d4e..f86cbe8dc1 100755
@@ -62,7 +62,7 @@ BEGIN {
 }
 END {
        if (count > 0) {
-               print "Warning in " substr(last_file,6) ":"
+               print "Warning in " substr(last_file,7) ":"
                print MESSAGE
                exit RET_ON_FAIL
        }
--
Quoted 3 lines

2.23.0