summaryrefslogtreecommitdiff
path: root/ruby_atomic.h
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-01-31 15:07:40 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-02-06 11:46:51 +0900
commit34fd7241e445764837ec9fc700af65a0f73e8ce5 (patch)
treeab5bfa57a0e5ed4b03fd7c9a96503ff17c46b0eb /ruby_atomic.h
parent72bbf60f3a6b87a36bebc6b10ae867d8bcb9cadd (diff)
fine-grained #ifdef guard for Sparc systems
There are cases when sizeof(int) == sizeof(long) == sizeof(size_t). On such cases however int and long are incompatible types in theory. We should not assume typedef long size_t, because on Solaris size_t is actually a typedef of int. This reduces compiler warnings on such situations.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2885
Diffstat (limited to 'ruby_atomic.h')
-rw-r--r--ruby_atomic.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 4a6723a92e..d4d56da424 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -105,7 +105,7 @@ typedef unsigned int rb_atomic_t;
# define ATOMIC_EXCHANGE(var, val) atomic_swap_uint(&(var), (val))
# define ATOMIC_CAS(var, oldval, newval) atomic_cas_uint(&(var), (oldval), (newval))
-# if SIZEOF_SIZE_T == SIZEOF_LONG
+# if defined(_LP64) || defined(_I32LPx)
# define ATOMIC_SIZE_ADD(var, val) atomic_add_long(&(var), (val))
# define ATOMIC_SIZE_SUB(var, val) atomic_add_long(&(var), -(val))
# define ATOMIC_SIZE_INC(var) atomic_inc_ulong(&(var))