git: cc96f92a570e - main - atomic: make atomic_store_ptr type-aware
Mateusz Guzik
mjguzik at gmail.com
Mon Jan 25 23:07:08 UTC 2021
On 1/25/21, Jessica Clarke <jrtc27 at freebsd.org> wrote:
> 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).
>
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>
More information about the dev-commits-src-main
mailing list