Skip to content

Commit

Permalink
atomic: fix position of volatile qualifier
Browse files Browse the repository at this point in the history
What needs to be volatile is not the pointer, but the pointed-to
value!

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Dec 23, 2014
1 parent c95f390 commit 2cbcfb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/qemu/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@
#endif

#ifndef atomic_read
#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
#define atomic_read(ptr) (*(__typeof__(*ptr) volatile*) (ptr))
#endif

#ifndef atomic_set
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i))
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) volatile*) (ptr)) = (i))
#endif

/* These have the same semantics as Java volatile variables.
Expand Down

0 comments on commit 2cbcfb2

Please sign in to comment.