diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-03 14:47:42 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-03 14:47:42 +0000 |
commit | b12ffcb15d57644423fbbb48b31f09e65aa0a00f (patch) | |
tree | 49061d574f02540b8aa59a5bd3ec312dc4e0c7e6 /ruby_atomic.h | |
parent | b2be623240af7b3318596fa348d2c7920f8703b5 (diff) | |
download | ruby-b12ffcb15d57644423fbbb48b31f09e65aa0a00f.tar.gz |
ruby_atomic.h: suppress warnigns
* ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in
VC6. only InterlockedCompareExchange is declared using PVOID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r-- | ruby_atomic.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h index 4a53e60824..53273a4026 100644 --- a/ruby_atomic.h +++ b/ruby_atomic.h @@ -50,6 +50,15 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val) #endif # define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val)) # define ATOMIC_CAS(var, oldval, newval) InterlockedCompareExchange(&(var), (newval), (oldval)) +# if defined _MSC_VER && _MSC_VER <= 1200 +static inline rb_atomic_t +rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval) +{ + return (rb_atomic_t)ATOMIC_CAS(*(PVOID *)var, (PVOID)oldval, (PVOID)(newval)); +} +# undef ATOMIC_CAS +# define ATOMIC_CAS(var, oldval, newval) (&(var), (newval), (oldval)) +# endif # ifdef _M_AMD64 # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val)) # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64(&(var), -(val)) |