Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/atomic Allow building with clang.
details: https://anonhg.NetBSD.org/src/rev/8e197ed75dba
branches: trunk
changeset: 326416:8e197ed75dba
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Jan 28 21:47:48 2014 +0000
description:
Allow building with clang.
XXX __RENAME is currently not allowed for the kernel, so use plain asm.
Clang rejects definitions of builtins, so it doesn't work without.
diffstat:
common/lib/libc/atomic/atomic_add_64_cas.c | 9 +++++----
common/lib/libc/atomic/atomic_and_64_cas.c | 9 +++++----
common/lib/libc/atomic/atomic_or_64_cas.c | 9 +++++----
3 files changed, 15 insertions(+), 12 deletions(-)
diffs (96 lines):
diff -r 21a83b02f329 -r 8e197ed75dba common/lib/libc/atomic/atomic_add_64_cas.c
--- a/common/lib/libc/atomic/atomic_add_64_cas.c Tue Jan 28 21:17:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_add_64_cas.c Tue Jan 28 21:47:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_add_64_cas.c,v 1.7 2014/01/27 18:29:47 matt Exp $ */
+/* $NetBSD: atomic_add_64_cas.c,v 1.8 2014/01/28 21:47:48 joerg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -35,10 +35,11 @@
#ifdef __HAVE_ATOMIC64_OPS
-uint64_t __sync_fetch_and_add_8(volatile uint64_t *, int64_t);
+uint64_t fetch_and_add_8(volatile uint64_t *, uint64_t, ...)
+ asm("__sync_fetch_and_add_8");
uint64_t
-__sync_fetch_and_add_8(volatile uint64_t *addr, int64_t val)
+fetch_and_add_8(volatile uint64_t *addr, uint64_t val, ...)
{
uint64_t old, new;
@@ -52,7 +53,7 @@
void
atomic_add_64(volatile uint64_t *addr, int64_t val)
{
- (void) __sync_fetch_and_add_8(addr, val);
+ (void) fetch_and_add_8(addr, val);
}
#undef atomic_add_64
diff -r 21a83b02f329 -r 8e197ed75dba common/lib/libc/atomic/atomic_and_64_cas.c
--- a/common/lib/libc/atomic/atomic_and_64_cas.c Tue Jan 28 21:17:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_and_64_cas.c Tue Jan 28 21:47:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_and_64_cas.c,v 1.8 2014/01/27 20:01:50 matt Exp $ */
+/* $NetBSD: atomic_and_64_cas.c,v 1.9 2014/01/28 21:47:48 joerg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -35,10 +35,11 @@
#ifdef __HAVE_ATOMIC64_OPS
-uint64_t __sync_fetch_and_and_8(volatile uint64_t *, uint64_t);
+uint64_t fetch_and_and_8(volatile uint64_t *, uint64_t, ...)
+ asm("__sync_fetch_and_and_8");
uint64_t
-__sync_fetch_and_and_8(volatile uint64_t *addr, uint64_t val)
+fetch_and_and_8(volatile uint64_t *addr, uint64_t val, ...)
{
uint64_t old, new;
@@ -52,7 +53,7 @@
void
atomic_and_64(volatile uint64_t *addr, uint64_t val)
{
- (void) __sync_fetch_and_and_8(addr, val);
+ (void) fetch_and_and_8(addr, val);
}
#undef atomic_and_64
diff -r 21a83b02f329 -r 8e197ed75dba common/lib/libc/atomic/atomic_or_64_cas.c
--- a/common/lib/libc/atomic/atomic_or_64_cas.c Tue Jan 28 21:17:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_or_64_cas.c Tue Jan 28 21:47:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_or_64_cas.c,v 1.8 2014/01/27 20:44:29 matt Exp $ */
+/* $NetBSD: atomic_or_64_cas.c,v 1.9 2014/01/28 21:47:48 joerg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -35,10 +35,11 @@
#ifdef __HAVE_ATOMIC64_OPS
-uint64_t __sync_fetch_and_or_8(volatile uint64_t *addr, uint64_t val);
+uint64_t fetch_and_or_8(volatile uint64_t *addr, uint64_t val, ...)
+ asm("__sync_fetch_and_or_8");
uint64_t
-__sync_fetch_and_or_8(volatile uint64_t *addr, uint64_t val)
+fetch_and_or_8(volatile uint64_t *addr, uint64_t val, ...)
{
uint64_t old, new;
@@ -52,7 +53,7 @@
void
atomic_or_64(volatile uint64_t *addr, uint64_t val)
{
- (void) __sync_fetch_and_or_8(addr, val);
+ (void) fetch_and_or_8(addr, val);
}
#undef atomic_or_64
Home |
Main Index |
Thread Index |
Old Index