Fix MSVC build

This commit is contained in:
lazymio 2022-04-16 23:37:52 +02:00
parent 3d3deac5e6
commit 656dde9f60
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873

View File

@ -199,13 +199,12 @@
/* These will only be atomic if the processor does the fetch or store /* These will only be atomic if the processor does the fetch or store
* in a single issue memory operation * in a single issue memory operation
*/ */
#define atomic_read__nocheck(p) (*(__typeof__(*(p)) volatile*) (p))
#define atomic_set__nocheck(p, i) ((*(__typeof__(*(p)) volatile*) (p)) = (i))
#define atomic_read(ptr) atomic_read__nocheck(ptr) #define atomic_read(ptr) *(ptr)
#define atomic_set(ptr, i) atomic_set__nocheck(ptr,i) #define atomic_set(ptr, i) *(ptr) = (i)
/** /**
*
* atomic_rcu_read - reads a RCU-protected pointer to a local variable * atomic_rcu_read - reads a RCU-protected pointer to a local variable
* into a RCU read-side critical section. The pointer can later be safely * into a RCU read-side critical section. The pointer can later be safely
* dereferenced within the critical section. * dereferenced within the critical section.
@ -224,9 +223,7 @@
* Should match atomic_rcu_set(), atomic_xchg(), atomic_cmpxchg(). * Should match atomic_rcu_set(), atomic_xchg(), atomic_cmpxchg().
*/ */
#define atomic_rcu_read(ptr) ({ \ #define atomic_rcu_read(ptr) ({ \
typeof(*ptr) _val = atomic_read(ptr); \ atomic_read(ptr); \
smp_read_barrier_depends(); \
_val; \
}) })
/** /**
@ -241,7 +238,6 @@
* Should match atomic_rcu_read(). * Should match atomic_rcu_read().
*/ */
#define atomic_rcu_set(ptr, i) do { \ #define atomic_rcu_set(ptr, i) do { \
smp_wmb(); \
atomic_set(ptr, i); \ atomic_set(ptr, i); \
} while (0) } while (0)