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

Align the implementation precedences with rb_atomic_t definition

On MinGW, where both of Win32 API and GCC built-ins are available,
the mismatch of implementations to the definition caused lots of
warnings.
This commit is contained in:
Nobuyoshi Nakada 2021-09-24 10:05:17 +09:00
parent b929af430c
commit 63297c2ca4
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -430,6 +430,9 @@ rbimpl_atomic_inc(volatile rb_atomic_t *ptr)
{
#if 0
#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_SYNC_BUILTINS)
rbimpl_atomic_add(ptr, 1);
#elif defined(_WIN32)
InterlockedIncrement(ptr);
@ -450,6 +453,9 @@ rbimpl_atomic_size_inc(volatile size_t *ptr)
{
#if 0
#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_SYNC_BUILTINS)
rbimpl_atomic_size_add(ptr, 1);
#elif defined(_WIN32) && defined(_M_AMD64)
InterlockedIncrement64(ptr);
@ -558,6 +564,9 @@ rbimpl_atomic_dec(volatile rb_atomic_t *ptr)
{
#if 0
#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_SYNC_BUILTINS)
rbimpl_atomic_sub(ptr, 1);
#elif defined(_WIN32)
InterlockedDecrement(ptr);
@ -578,6 +587,9 @@ rbimpl_atomic_size_dec(volatile size_t *ptr)
{
#if 0
#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_SYNC_BUILTINS)
rbimpl_atomic_size_sub(ptr, 1);
#elif defined(_WIN32) && defined(_M_AMD64)
InterlockedDecrement64(ptr);