ruby-changes:29707
From: nobu <ko1@a...>
Date: Wed, 3 Jul 2013 23:47:59 +0900 (JST)
Subject: [ruby-changes:29707] nobu:r41759 (trunk): ruby_atomic.h: suppress warnigns
nobu 2013-07-03 23:47:42 +0900 (Wed, 03 Jul 2013) New Revision: 41759 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41759 Log: ruby_atomic.h: suppress warnigns * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in VC6. only InterlockedCompareExchange is declared using PVOID. Modified files: trunk/ChangeLog trunk/ruby_atomic.h Index: ChangeLog =================================================================== --- ChangeLog (revision 41758) +++ ChangeLog (revision 41759) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 3 23:47:35 2013 Nobuyoshi Nakada <nobu@r...> + + * ruby_atomic.h (ATOMIC_CAS): suppress C4022 and C4047 warnings in + VC6. only InterlockedCompareExchange is declared using PVOID. + Wed Jul 3 22:29:20 2013 Tanaka Akira <akr@f...> * internal.h (ruby_digit36_to_number_table): Declared. Index: ruby_atomic.h =================================================================== --- ruby_atomic.h (revision 41758) +++ ruby_atomic.h (revision 41759) @@ -50,6 +50,15 @@ rb_w32_atomic_or(volatile rb_atomic_t *v https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L50 #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)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/