Skip to content

Commit

Permalink
devtools: forbid more builtin helpers for bit count
Browse files Browse the repository at this point in the history
Extend checkpatches.sh to detect the use of __builtin_(ffs|ffsll).

These intrinsics are not available in MSVC, and there are perfectly
serviceable alternatives in <rte_bitops.h>.

Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
m-ronnblom authored and david-marchand committed Oct 16, 2024
1 parent 5f3cd04 commit 65c6733
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion devtools/checkpatches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ check_forbidden_additions() { # <patch>

# 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 EXPRESSIONS='\\<__builtin_(clz|ctz|ffs|popcount)(ll)?\\>' \
-v RET_ON_FAIL=1 \
-v MESSAGE='Using __builtin helpers for bit count operations' \
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
Expand Down

0 comments on commit 65c6733

Please sign in to comment.