git: cc96f92a570e - main - atomic: make atomic_store_ptr type-aware
Jessica Clarke
jrtc27 at freebsd.org
Mon Jan 25 22:52:23 UTC 2021
On 25 Jan 2021, at 22:42, Mateusz Guzik <mjg at FreeBSD.org> wrote:
> index a3548977b940..4c29d132c369 100644
> --- a/sys/sys/atomic_common.h
> +++ b/sys/sys/atomic_common.h
> @@ -58,7 +58,7 @@
> #define atomic_store_long(p, v) \
> (*(volatile u_long *)(p) = (u_long)(v))
> #define atomic_store_ptr(p, v) \
> - (*(volatile uintptr_t *)(p) = (uintptr_t)(v))
> + (*(volatile __typeof(*p) *)(p) = (v))
This is in fact general enough to be any of the atomic_store_*, and
won't give any errors if you use it for a uint16_t (where it will store
a uint16_t).
Jess
More information about the dev-commits-src-main
mailing list