Skip to contentSkip to conversation

lib.c: Add __sync_lock_test_and_set as a builtin function

PATCH In review Ramsay Jones 2 participants 3 messages May 21, 2013 – May 25, 2013 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 lib.c: Add __sync_lock_test_and_set as a builtin function

---
 lib.c | 1 +
 1 file changed, 1 insertion(+)
lib.c +1 -0
index 7e822eb..2dca810 100644
@@ -779,6 +779,7 @@ void declare_builtin_functions(void)
 	add_pre_buffer("extern double __builtin_fabs(double);\n");
 	add_pre_buffer("extern void __sync_synchronize();\n");
 	add_pre_buffer("extern int __sync_bool_compare_and_swap(void *, ...);\n");
+	add_pre_buffer("extern int __sync_lock_test_and_set(volatile long *const, const long);\n");
 
 	/* Add Blackfin-specific stuff */
 	add_pre_buffer(
Signature · 1 line
1.8.2
maintainer
#1 lore raw
Quoted 1 line · Ramsay Jones

+ add_pre_buffer("extern int __sync_lock_test_and_set(volatile long *const, const long);\n");

Looking at the gcc documents about atomic builtins. quote:
"and further that they are overloaded such that they work on multiple types"

Sparse does not do type overload. Which means sparse can't properly support this function right now. If some one try to use this function on an int type, sparse will
complain about type mismatch.

Chris

#2 lore raw
Quoted 7 lines · Christopher Li
Quoted 1 line · Ramsay Jones

+ add_pre_buffer("extern int __sync_lock_test_and_set(volatile long *const, const long);\n");

Looking at the gcc documents about atomic builtins. quote:
"and further that they are overloaded such that they work on multiple types"

Ah, yes, I obviously didn't investigate this carefully enough! :( OK, so we can forget about this patch.

Thanks!

ATB,
Ramsay Jones