diff options
| author | Kim Phillips <kim.phillips@linaro.org> | 2013-12-11 15:00:13 -0600 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2013-12-21 09:17:31 -0800 |
| commit | 5c8c8ce62462aa70dfaf193552acd68499ba4208 (patch) | |
| tree | fee272be08bcd061073fed1fb527fb1d95659553 /validation | |
| parent | 3017be15c4eab3db83ac1f6b27759d77f4ce2b57 (diff) | |
| download | sparse-dev-5c8c8ce62462aa70dfaf193552acd68499ba4208.tar.gz | |
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'
Reported-by: Mike Holmes <mike.holmes@linaro.org>
Signed-off-by: Kim Phillips <kim.phillips@linaro.org>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/builtin_atomic.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/builtin_atomic.c b/validation/builtin_atomic.c new file mode 100644 index 00000000..e56321a8 --- /dev/null +++ b/validation/builtin_atomic.c @@ -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 + */ |
