Date: Mon, 25 Jan 2021 22:52:21 +0000 From: Jessica Clarke <jrtc27@freebsd.org> To: Mateusz Guzik <mjg@FreeBSD.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: cc96f92a570e - main - atomic: make atomic_store_ptr type-aware Message-ID: <BEA86FFF-69CE-439F-B730-A6FC47579A33@freebsd.org> In-Reply-To: <202101252242.10PMgZfO026271@gitrepo.freebsd.org> References: <202101252242.10PMgZfO026271@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 25 Jan 2021, at 22:42, Mateusz Guzik <mjg@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BEA86FFF-69CE-439F-B730-A6FC47579A33>