Skip to content

Commit

Permalink
* atomic.h(ATOMIC_SET): add cast to void to prevent misuse.
Browse files Browse the repository at this point in the history
  [ruby-dev:44596] [Bug ruby#5439]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosaki committed Oct 13, 2011
1 parent 09d18be commit 123645a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions 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):
Expand Down
4 changes: 2 additions & 2 deletions atomic.h
Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 123645a

Please sign in to comment.