summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-21 11:46:39 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-28 00:55:06 -0800
commit74c3c2ccb49a46fc58aa7ec2506b6f05731d316b (patch)
tree9afeb6c3478d9f302e056c12ffc33c8e21680901 /osdep
parentaa974b2aa7b99ec94f66272a7ddd4bfc62438a2f (diff)
downloadmpv-74c3c2ccb49a46fc58aa7ec2506b6f05731d316b.tar.bz2
mpv-74c3c2ccb49a46fc58aa7ec2506b6f05731d316b.tar.xz
osdep/atomic: fix potential shadowing warnings
The stdatomic emulation adds "_" to each variable used inside the macros, to avoid that compilers print -Wshadow warnings for identifiers that are also used in surrounding code. Do this more consistently, because new warnings have been showing up.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/atomic.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/osdep/atomic.h b/osdep/atomic.h
index a5608fa78a..85773cbcb5 100644
--- a/osdep/atomic.h
+++ b/osdep/atomic.h
@@ -54,9 +54,9 @@ extern pthread_mutex_t mp_atomic_mutex;
#define atomic_load(p) \
({ __typeof__(p) p_ = (p); \
pthread_mutex_lock(&mp_atomic_mutex); \
- __typeof__(p_->v) v = p_->v; \
+ __typeof__(p_->v) v_ = p_->v; \
pthread_mutex_unlock(&mp_atomic_mutex); \
- v; })
+ v_; })
#define atomic_store(p, val) \
({ __typeof__(val) val_ = (val); \
__typeof__(p) p_ = (p); \
@@ -67,10 +67,10 @@ extern pthread_mutex_t mp_atomic_mutex;
({ __typeof__(a) a_ = (a); \
__typeof__(b) b_ = (b); \
pthread_mutex_lock(&mp_atomic_mutex); \
- __typeof__(a_->v) v = a_->v; \
- a_->v = v op b_; \
+ __typeof__(a_->v) v_ = a_->v; \
+ a_->v = v_ op b_; \
pthread_mutex_unlock(&mp_atomic_mutex); \
- v; })
+ v_; })
#define atomic_fetch_add(a, b) atomic_fetch_op(a, b, +)
#define atomic_fetch_and(a, b) atomic_fetch_op(a, b, &)
#define atomic_fetch_or(a, b) atomic_fetch_op(a, b, |)
@@ -79,14 +79,14 @@ extern pthread_mutex_t mp_atomic_mutex;
__typeof__(old) old_ = (old); \
__typeof__(new) new_ = (new); \
pthread_mutex_lock(&mp_atomic_mutex); \
- int res = p_->v == *old_; \
- if (res) { \
+ int res_ = p_->v == *old_; \
+ if (res_) { \
p_->v = new_; \
} else { \
*old_ = p_->v; \
} \
pthread_mutex_unlock(&mp_atomic_mutex); \
- res; })
+ res_; })
#endif /* else HAVE_STDATOMIC */