Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2021 00:07:05 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Jessica Clarke <jrtc27@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:  <CAGudoHExL%2BCrgza-GyLXfKgF5vBC9gnsFP=a4G59iM2cme%2B8Bg@mail.gmail.com>
In-Reply-To: <BEA86FFF-69CE-439F-B730-A6FC47579A33@freebsd.org>
References:  <202101252242.10PMgZfO026271@gitrepo.freebsd.org> <BEA86FFF-69CE-439F-B730-A6FC47579A33@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/25/21, Jessica Clarke <jrtc27@freebsd.org> wrote:
> 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).
>

Unclear if you are suggesting validating that the passed thing is a
pointer or replacing the rest. The former is useful, the latter is
significantly more work.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHExL%2BCrgza-GyLXfKgF5vBC9gnsFP=a4G59iM2cme%2B8Bg>