[Mesa-dev] [PATCH 2/2] Add prototypes for 64bit atomics fallback

Jan Beich jbeich at FreeBSD.org
Sat May 13 09:21:12 UTC 2017


u_atomic.c:67:1: error: no previous prototype for function '__atomic_fetch_add_8'
      [-Werror,-Wmissing-prototypes]
__atomic_fetch_add_8(uint64_t *ptr, uint64_t val, int memorder)
^
u_atomic.c:73:1: error: no previous prototype for function '__atomic_fetch_sub_8'
      [-Werror,-Wmissing-prototypes]
__atomic_fetch_sub_8(uint64_t *ptr, uint64_t val, int memorder)
^
2 errors generated.

Signed-off-by: Jan Beich <jbeich at FreeBSD.org>
---
 src/util/u_atomic.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/u_atomic.c b/src/util/u_atomic.c
index 691c34cf30..ce600aeeed 100644
--- a/src/util/u_atomic.c
+++ b/src/util/u_atomic.c
@@ -34,6 +34,14 @@
 
 static pthread_mutex_t sync_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+#ifdef USE_GCC_ATOMIC_BUILTINS
+uint64_t __atomic_fetch_add_8(uint64_t *ptr, uint64_t val, int memorder);
+uint64_t __atomic_fetch_sub_8(uint64_t *ptr, uint64_t val, int memorder);
+#else
+uint64_t __sync_add_and_fetch_8(uint64_t *ptr, uint64_t val);
+uint64_t __sync_sub_and_fetch_8(uint64_t *ptr, uint64_t val);
+#endif
+
 #ifndef USE_GCC_ATOMIC_BUILTINS
 WEAK uint64_t
 __sync_add_and_fetch_8(uint64_t *ptr, uint64_t val)


More information about the mesa-dev mailing list