Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* atomic.h(ATOMIC_SET): add cast to void to prevent misuse.

  [ruby-dev:44596] [Bug #5439]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 123645aab61c07fb3c64e3f2ea771cb74f53ff64 1 parent 09d18be
@kosaki kosaki authored
Showing with 7 additions and 2 deletions.
  1. +5 −0 ChangeLog
  2. +2 −2 atomic.h
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 13 18:13:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * atomic.h(ATOMIC_SET): add cast to void to prevent misuse.
+ [ruby-dev:44596] [Bug #5439]
+
Thu Oct 13 18:04:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (rb_gc_finalize_deferred, rb_objspace_call_finalizer):
View
4 atomic.h
@@ -36,7 +36,7 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
* http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html */
typedef unsigned int rb_atomic_t; /* Anything OK */
-# define ATOMIC_SET(var, val) __sync_lock_test_and_set(&(var), (val))
+# define ATOMIC_SET(var, val) (void)__sync_lock_test_and_set(&(var), (val))
# define ATOMIC_INC(var) __sync_fetch_and_add(&(var), 1)
# define ATOMIC_DEC(var) __sync_fetch_and_sub(&(var), 1)
# define ATOMIC_OR(var, val) __sync_or_and_fetch(&(var), (val))
@@ -46,7 +46,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
typedef int rb_atomic_t;
extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val);
-# define ATOMIC_SET(var, val) ((var) = (val))
+# define ATOMIC_SET(var, val) (void)((var) = (val))
# define ATOMIC_INC(var) (++(var))
# define ATOMIC_DEC(var) (--(var))
# define ATOMIC_OR(var, val) ((var) |= (val))
Please sign in to comment.
Something went wrong with that request. Please try again.