[v2,02/14] devtools: report all warnings in forbidden token check

Message ID 20240912082643.1532679-3-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series Use RTE_LOG_LINE in drivers |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Sept. 12, 2024, 8:26 a.m. UTC
Do not stop at the first file that got warnings.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/check-forbidden-tokens.awk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Sept. 12, 2024, 2:10 p.m. UTC | #1
12/09/2024 10:26, David Marchand:
> Do not stop at the first file that got warnings.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

It is always better to get all issues in one pass.

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  

Patch

diff --git a/devtools/check-forbidden-tokens.awk b/devtools/check-forbidden-tokens.awk
index 807dad7f48..d72d244d3a 100755
--- a/devtools/check-forbidden-tokens.awk
+++ b/devtools/check-forbidden-tokens.awk
@@ -13,6 +13,7 @@  BEGIN {
 	in_file=0;
 	in_comment=0;
 	count=0;
+	warned=0;
 	comment_start="/*"
 	comment_end="*/"
 }
@@ -50,7 +51,8 @@  BEGIN {
 ($0 ~ "^\\+\\+\\+ b/") {
 	in_file = 0;
 	if (count > 0) {
-		exit;
+		warned = warned + 1
+		print "Warning in " substr(last_file,7) ":"
 	}
 	count = 0
 	for (i in deny_folders) {
@@ -66,7 +68,10 @@  BEGIN {
 }
 END {
 	if (count > 0) {
+		warned = warned + 1
 		print "Warning in " substr(last_file,7) ":"
+	}
+	if (warned > 0) {
 		print MESSAGE
 		exit RET_ON_FAIL
 	}