sparse: add built-in atomic memory access identifiers
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAKb83kaz+csV4Q=0P5Q+L75_CxYnL=RrDh4mSTujPmzJ9B7K-g@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CADz3at2h9gDJkEz9FctvvPqj7_isoXj_hpPzJiQzSi2UNyn97g@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CAKb83kYKo=YP4JC2cjo-Y76xEvC45CM=5Wf9rO1Hv-06OSt5-Q@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CADz3at1A3id81XpKFf3gJhutWEpFi4zM0+xF=cfY-h_+ABd=gw@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAKb83kZ4jYeiFAxpxqVwLtWYA3sobrN0vGDRzK0vs_jommsCwQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): CADz3at0E7W=V17mO6D6hZrLp82VoC42_Jz==iSVUykz6+76phQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 sparse: add built-in atomic memory access identifiers
this patch stops sparse from complaining about them not being defined:
source/odp_spinlock.c:41:10: error: undefined identifier '__sync_lock_release' source/odp_spinlock.c:54:10: error: undefined identifier '__sync_lock_release' ./odp_atomic.h:112:16: error: undefined identifier '__sync_fetch_and_add'
---
also available here:
git://git.linaro.org/people/kim.phillips/sparse.git
lib.c | 21 +++++++++++++++++++-- validation/builtin_atomic.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 validation/builtin_atomic.c
lib.c +19 -2
@@ -777,6 +777,25 @@ void declare_builtin_functions(void)add_pre_buffer ("extern unsigned int __builtin_bswap32(unsigned int);\n" );add_pre_buffer ("extern unsigned long long __builtin_bswap64(unsigned long long);\n" ); +/* And atomic memory access functions.. */ +add_pre_buffer ("extern int __sync_fetch_and_add(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_fetch_and_sub(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_fetch_and_or(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_fetch_and_and(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_fetch_and_xor(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_fetch_and_nand(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_add_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_sub_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_or_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_and_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_xor_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_nand_and_fetch(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_bool_compare_and_swap(void *, ...);\n" ); +add_pre_buffer ("extern int __sync_val_compare_and_swap(void *, ...);\n" ); +add_pre_buffer ("extern void __sync_synchronize();\n" ); +add_pre_buffer ("extern int __sync_lock_test_and_set(void *, ...);\n" ); +add_pre_buffer ("extern void __sync_lock_release(void *, ...);\n" ); +/* And some random ones.. */ add_pre_buffer ("extern void *__builtin_return_address(unsigned int);\n" );add_pre_buffer ("extern void *__builtin_extract_return_addr(void *);\n" );
@@ -794,8 +813,6 @@ void declare_builtin_functions(void)add_pre_buffer ("extern long __builtin_labs(long);\n" );add_pre_buffer ("extern double __builtin_fabs(double);\n" );add_pre_buffer ("extern __SIZE_TYPE__ __builtin_va_arg_pack_len(void);\n" ); -add_pre_buffer ("extern void __sync_synchronize();\n" ); -add_pre_buffer ("extern int __sync_bool_compare_and_swap(void *, ...);\n" );/* Add Blackfin-specific stuff */ add_pre_buffer(
validation/builtin_atomic.c new file +28 -0
@@ -0,0 +1,28 @@ +static void fn (void ) +{ +static int i, *ptr = (void *)0 ; + + i =__sync_fetch_and_add (ptr,0 ); + i =__sync_fetch_and_sub (ptr,0 ); + i =__sync_fetch_and_or (ptr,0 ); + i =__sync_fetch_and_and (ptr,0 ); + i =__sync_fetch_and_xor (ptr,0 ); + i =__sync_fetch_and_nand (ptr,0 ); + i =__sync_add_and_fetch (ptr,0 ); + i =__sync_sub_and_fetch (ptr,0 ); + i =__sync_or_and_fetch (ptr,0 ); + i =__sync_and_and_fetch (ptr,0 ); + i =__sync_xor_and_fetch (ptr,0 ); + i =__sync_nand_and_fetch (ptr,0 ); + i =__sync_bool_compare_and_swap (ptr,0 ,1 ); + i =__sync_val_compare_and_swap (ptr,0 ,1 ); +__sync_synchronize (); + i =__sync_lock_test_and_set (ptr,0 ); +__sync_lock_release (ptr); +} + +/* +* check-name: __builtin_atomic +* check-error-start +* check-error-end +*/
Signature · 1 line
1.8.5.1
Christopher Li
maintainerQuoted 9 lines · Kim Phillips
this patch stops sparse from complaining about them not being defined:
source/odp_spinlock.c:41:10: error: undefined identifier '__sync_lock_release'source/odp_spinlock.c:54:10: error: undefined identifier '__sync_lock_release' ./odp_atomic.h:112:16: error: undefined identifier '__sync_fetch_and_add'Reported-by Mike Holmes <[email protected]>Signed-off-by Kim Phillips <[email protected]>
Applied and pushed.
Chris