Skip to contentSkip to conversation

devtools: extend check on compiler builtin atomics

PATCH In review David Marchand 2 participants 3 messages Oct 17, 2023 – Oct 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: extend check on compiler builtin atomics

rte_memory_order_* should be used when calling the new stdatomic API. Add a check on __ATOMIC_* tokens.

---
 devtools/checkpatches.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/checkpatches.sh +2 -2
index 2635923e14..7740152643 100755
@@ -113,9 +113,9 @@ check_forbidden_additions() { # <patch>
 
 	# refrain from using compiler __atomic_xxx builtins
 	awk -v FOLDERS="lib drivers app examples" \
-		-v EXPRESSIONS="__atomic_.*\\\(" \
+		-v EXPRESSIONS="__atomic_.*\\\( __ATOMIC_(RELAXED|CONSUME|ACQUIRE|RELEASE|ACQ_REL|SEQ_CST)" \
 		-v RET_ON_FAIL=1 \
-		-v MESSAGE='Using __atomic_xxx built-ins, prefer rte_atomic_xxx' \
+		-v MESSAGE='Using __atomic_xxx/__ATOMIC_XXX built-ins, prefer rte_atomic_xxx' \
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
Signature · 1 line
2.41.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · David Marchand

rte_memory_order_* should be used when calling the new stdatomic API. Add a check on __ATOMIC_* tokens.

---

Quoted 8 lines
 devtools/checkpatches.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
devtools/checkpatches.sh +0 -0
index 2635923e14..7740152643 100755

devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 118

Quoted 8 lines
devtools/checkpatches.sh +2 -2
@@ -113,9 +113,9 @@ check_forbidden_additions() { # <patch>
 
 	# refrain from using compiler __atomic_xxx builtins
 	awk -v FOLDERS="lib drivers app examples" \
-		-v EXPRESSIONS="__atomic_.*\\\(" \
+		-v EXPRESSIONS="__atomic_.*\\\( __ATOMIC_(RELAXED|CONSUME|ACQUIRE|RELEASE|ACQ_REL|SEQ_CST)" \
 		-v RET_ON_FAIL=1 \
-		-v MESSAGE='Using __atomic_xxx built-ins, prefer rte_atomic_xxx' \
+		-v MESSAGE='Using __atomic_xxx/__ATOMIC_XXX built-ins, prefer rte_atomic_xxx' \

Not sure if it should say prefer rte_atomic_xxx/rte_memory_order_xxx ?

Either way it catches the problem.

author Applied
#2 lore raw
Quoted 8 lines · Tyler Retzlaff
Quoted 4 lines · David Marchand

rte_memory_order_* should be used when calling the new stdatomic API. Add a check on __ATOMIC_* tokens.

[snip]

Quoted 5 lines

devtools/checkpatches.sh check_forbidden_additions() { # <patch> · line 118

Quoted 3 lines
              -v RET_ON_FAIL=1 \
devtools/checkpatches.sh +1 -1
-             -v MESSAGE='Using __atomic_xxx built-ins, prefer rte_atomic_xxx' \
+             -v MESSAGE='Using __atomic_xxx/__ATOMIC_XXX built-ins, prefer rte_atomic_xxx' \

Not sure if it should say prefer rte_atomic_xxx/rte_memory_order_xxx ?

Looks ok to me, I did this small change while applying.

Applied, thanks.

Signature · 1 line
David Marchand