1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
卜部昌平 2020-01-31 15:07:40 +09:00
parent 72bbf60f3a
commit 34fd7241e4
Notes: git 2020-02-06 11:47:22 +09:00

View file

@ -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))