diff mbox

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

Message ID 519BC8AF.8060804@ramsay1.demon.co.uk (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Ramsay Jones May 21, 2013, 7:19 p.m. UTC
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 lib.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christopher Li May 23, 2013, 3:15 a.m. UTC | #1
On Tue, May 21, 2013 at 12:19 PM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
> +       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
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones May 25, 2013, 7:40 p.m. UTC | #2
Christopher Li wrote:
> On Tue, May 21, 2013 at 12:19 PM, Ramsay Jones
> <ramsay@ramsay1.demon.co.uk> wrote:
>> +       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



--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib.c b/lib.c
index 7e822eb..2dca810 100644
--- a/lib.c
+++ b/lib.c
@@ -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(