atomics: atomic_load_consume_ptr(): Accept pointers to const

Now that all directly-implemented loads (with acquire semantics or not)
accept pointers to const, ensure that atomic_load_consume_ptr(), built
on atomic_load_acq_ptr(), does so too, in the common atomics header as
well as *SAN interceptors.

Reviewed by:    kib
Fixes:          5e9a82e898d5 ("atomics: Constify loads")
MFC after:      4 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D48497

(cherry picked from commit 8dd436fca1149ec7e56f6f06abde50a2e8796ad6)
This commit is contained in:
Olivier Certner 2025-01-20 14:53:35 +01:00
parent d034ff89b8
commit 19f7b2bbc4
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
2 changed files with 2 additions and 2 deletions

View file

@ -133,7 +133,7 @@
* openly resorting to the stronger acquire fence, to be sorted out.
*/
#define atomic_load_consume_ptr(p) \
((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p))
((__typeof(*p)) atomic_load_acq_ptr((const volatile uintptr_t *)p))
#define atomic_interrupt_fence() __compiler_membar()

View file

@ -270,7 +270,7 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX);
__DECONST(volatile uintptr_t *, (x))))
#define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr)
#define atomic_load_consume_ptr(x) \
((__typeof(*x))atomic_load_acq_ptr((volatile uintptr_t *)(x)))
((__typeof(*x))atomic_load_acq_ptr((const volatile uintptr_t *)(x)))
#define atomic_readandclear_ptr ATOMIC_SAN(readandclear_ptr)
#define atomic_set_ptr ATOMIC_SAN(set_ptr)
#define atomic_set_acq_ptr ATOMIC_SAN(set_acq_ptr)