diff options
author | Tom de Vries <tdevries@suse.de> | 2020-09-09 18:43:13 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-09-09 19:22:07 +0200 |
commit | 7b9c26519e6aa07a0709c5c6fcc2b9a6ba050e7a (patch) | |
tree | 694f4b91c7843b6ba15de43ae777d7ac5e7f1902 /libgcc | |
parent | 69ca5f3a988266da8905aef9cf22aa02807e0471 (diff) | |
download | gcc-7b9c26519e6aa07a0709c5c6fcc2b9a6ba050e7a.zip gcc-7b9c26519e6aa07a0709c5c6fcc2b9a6ba050e7a.tar.gz gcc-7b9c26519e6aa07a0709c5c6fcc2b9a6ba050e7a.tar.bz2 |
[nvptx, libgcc] Fix Wbuiltin-declaration-mismatch in atomic.c
When building for target nvptx, we get this and similar warnings for libgcc:
...
src/libgcc/config/nvptx/atomic.c:39:1: warning: conflicting types for \
built-in function ‘__sync_val_compare_and_swap_1’; expected \
‘unsigned char(volatile void *, unsigned char, unsigned char)’ \
[-Wbuiltin-declaration-mismatch]
...
Fix this by making sure in atomic.c that the pointers used are of type
'volatile void *'.
Tested by rebuilding atomic.c.
libgcc/ChangeLog:
* config/nvptx/atomic.c (__SYNC_SUBWORD_COMPARE_AND_SWAP): Fix
Wbuiltin-declaration-mismatch.
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/config/nvptx/atomic.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libgcc/config/nvptx/atomic.c b/libgcc/config/nvptx/atomic.c index e1ea078..60f21f3 100644 --- a/libgcc/config/nvptx/atomic.c +++ b/libgcc/config/nvptx/atomic.c @@ -36,10 +36,13 @@ #define __SYNC_SUBWORD_COMPARE_AND_SWAP(TYPE, SIZE) \ \ TYPE \ -__sync_val_compare_and_swap_##SIZE (TYPE *ptr, TYPE oldval, TYPE newval) \ +__sync_val_compare_and_swap_##SIZE (volatile void *vptr, TYPE oldval, \ + TYPE newval) \ { \ - unsigned int *wordptr = (unsigned int *)((__UINTPTR_TYPE__ ) ptr & ~3UL); \ - int shift = ((__UINTPTR_TYPE__ ) ptr & 3UL) * 8; \ + volatile TYPE *ptr = vptr; \ + volatile unsigned int *wordptr \ + = (volatile unsigned int *)((__UINTPTR_TYPE__) ptr & ~3UL); \ + int shift = ((__UINTPTR_TYPE__) ptr & 3UL) * 8; \ unsigned int valmask = (1 << (SIZE * 8)) - 1; \ unsigned int wordmask = ~(valmask << shift); \ unsigned int oldword = *wordptr; \ @@ -64,7 +67,8 @@ __sync_val_compare_and_swap_##SIZE (TYPE *ptr, TYPE oldval, TYPE newval) \ } \ \ bool \ -__sync_bool_compare_and_swap_##SIZE (TYPE *ptr, TYPE oldval, TYPE newval) \ +__sync_bool_compare_and_swap_##SIZE (volatile void *ptr, TYPE oldval, \ + TYPE newval) \ { \ return __sync_val_compare_and_swap_##SIZE (ptr, oldval, newval) == oldval; \ } |