Module Name: src Committed By: mrg Date: Mon Sep 7 00:52:19 UTC 2020
Modified Files: src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c atomic_c11_compare_exchange_cas_32.c atomic_c11_compare_exchange_cas_8.c atomic_load.c atomic_store.c Log Message: make some prototypes match the builtin properly. GCC 9 complains with the old version, GCC 8 is happy with this version. tested on sparc. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c \ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c \ src/common/lib/libc/atomic/atomic_load.c \ src/common/lib/libc/atomic/atomic_store.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.2 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.3 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.2 Tue Nov 4 19:56:44 2014 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c Mon Sep 7 00:52:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -36,15 +36,15 @@ #endif #include <sys/atomic.h> -bool __atomic_compare_exchange_2(volatile uint16_t *, uint16_t *, uint16_t, +bool __atomic_compare_exchange_2(volatile void *, void *, uint16_t, bool, int, int); bool -__atomic_compare_exchange_2(volatile uint16_t *mem, - uint16_t *expected, uint16_t desired, +__atomic_compare_exchange_2(volatile void *mem, + void *expected, uint16_t desired, bool weak, int success, int failure) { - uint16_t old = *expected; + uint16_t old = *(uint16_t *)expected; /* * Ignore the details (weak, memory model on success and failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.2 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.3 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.2 Tue Nov 4 19:56:44 2014 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c Mon Sep 7 00:52:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -36,15 +36,15 @@ #endif #include <sys/atomic.h> -bool __atomic_compare_exchange_4(volatile uint32_t *, uint32_t *, uint32_t, +bool __atomic_compare_exchange_4(volatile void *, void *, uint32_t, bool, int, int); bool -__atomic_compare_exchange_4(volatile uint32_t *mem, - uint32_t *expected, uint32_t desired, +__atomic_compare_exchange_4(volatile void *mem, + void *expected, uint32_t desired, bool weak, int success, int failure) { - uint32_t old = *expected; + uint32_t old = *(uint32_t *)expected; /* * Ignore the details (weak, memory model on success and failure) Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c diff -u src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.2 src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.3 --- src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c:1.2 Tue Nov 4 19:56:44 2014 +++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c Mon Sep 7 00:52:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ +/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -36,15 +36,15 @@ #endif #include <sys/atomic.h> -bool __atomic_compare_exchange_1(volatile uint8_t *, uint8_t *, uint8_t, +bool __atomic_compare_exchange_1(volatile void *, void *, uint8_t, bool, int, int); bool -__atomic_compare_exchange_1(volatile uint8_t *mem, - uint8_t *expected, uint8_t desired, +__atomic_compare_exchange_1(volatile void *mem, + void *expected, uint8_t desired, bool weak, int success, int failure) { - uint8_t old = *expected; + uint8_t old = *(uint8_t *)expected; /* * Ignore the details (weak, memory model on success and failure) Index: src/common/lib/libc/atomic/atomic_load.c diff -u src/common/lib/libc/atomic/atomic_load.c:1.2 src/common/lib/libc/atomic/atomic_load.c:1.3 --- src/common/lib/libc/atomic/atomic_load.c:1.2 Sun Jul 6 01:19:45 2014 +++ src/common/lib/libc/atomic/atomic_load.c Mon Sep 7 00:52:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_load.c,v 1.2 2014/07/06 01:19:45 joerg Exp $ */ +/* $NetBSD: atomic_load.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: atomic_load.c,v 1.2 2014/07/06 01:19:45 joerg Exp $"); +__RCSID("$NetBSD: atomic_load.c,v 1.3 2020/09/07 00:52:19 mrg Exp $"); #include "atomic_op_namespace.h" @@ -35,13 +35,13 @@ __RCSID("$NetBSD: atomic_load.c,v 1.2 20 #include <sys/atomic.h> #define atomic_load_n(n,b) \ -uint ## b ## _t __atomic_load_ ## n(volatile uint ## b ## _t *, int); \ +uint ## b ## _t __atomic_load_ ## n(const volatile void *, int); \ uint ## b ## _t \ -__atomic_load_ ## n(volatile uint ## b ## _t *ptr, int memmodel) \ +__atomic_load_ ## n(const volatile void *ptr, int memmodel) \ { \ uint## b ##_t val; \ membar_enter(); \ - val = *ptr; \ + val = *(const volatile uint ## b ## _t *)ptr; \ membar_exit(); \ return val; \ } Index: src/common/lib/libc/atomic/atomic_store.c diff -u src/common/lib/libc/atomic/atomic_store.c:1.2 src/common/lib/libc/atomic/atomic_store.c:1.3 --- src/common/lib/libc/atomic/atomic_store.c:1.2 Sun Jul 6 01:19:45 2014 +++ src/common/lib/libc/atomic/atomic_store.c Mon Sep 7 00:52:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_store.c,v 1.2 2014/07/06 01:19:45 joerg Exp $ */ +/* $NetBSD: atomic_store.c,v 1.3 2020/09/07 00:52:19 mrg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: atomic_store.c,v 1.2 2014/07/06 01:19:45 joerg Exp $"); +__RCSID("$NetBSD: atomic_store.c,v 1.3 2020/09/07 00:52:19 mrg Exp $"); #include "atomic_op_namespace.h" @@ -35,13 +35,13 @@ __RCSID("$NetBSD: atomic_store.c,v 1.2 2 #include <sys/atomic.h> #define atomic_store_n(n,b) \ -void __atomic_store_ ## n(volatile uint ## b ## _t *, uint ## b ## _t, int); \ +void __atomic_store_ ## n(volatile void *, uint ## b ## _t, int); \ void \ -__atomic_store_ ## n(volatile uint ## b ## _t *ptr, uint ## b ## _t val, \ +__atomic_store_ ## n(volatile void *ptr, uint ## b ## _t val, \ int memmodel) \ { \ membar_enter(); \ - *ptr = val; \ + *(volatile uint ## b ## _t *)ptr = val; \ membar_exit(); \ }