[PATCH 2/2] devtools: forbid use of builtin helpers for bit count

David Marchand david.marchand at redhat.com
Fri Aug 25 12:18:11 CEST 2023


Now that DPDK provides some bit count operations, flag it to avoid
reintroducing __builtin_*.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 43f5e36a18..55fabc5458 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -127,6 +127,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of non abstracted bit count operations
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='\\<__builtin_(clz|clzll|ctz|ctzll|popcount|popcountll)\\>' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using __builtin helpers for bit count operations' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# forbid use of experimental build flag except in examples
 	awk -v FOLDERS='lib drivers app' \
 		-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \
-- 
2.41.0



More information about the dev mailing list