devtools: fix filename in forbidden token check
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:
--- devtools/check-forbidden-tokens.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/check-forbidden-tokens.awk +1 -1
@@ -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
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:]].
--- devtools/checkpatches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/checkpatches.sh +1 -1
@@ -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
Thomas Monjalon
AppliedRe: [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")Signed-off-by David Marchand <[email protected]>
Applied, thanks
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 inlib/librte_eal/linux/eal.c:Fixes 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")Signed-off-by David Marchand <[email protected]>--- devtools/check-forbidden-tokens.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)devtools/check-forbidden-tokens.awk +1
-2@@ -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