ruby-changes:68106
From: Nobuyoshi <ko1@a...>
Date: Fri, 24 Sep 2021 10:15:14 +0900 (JST)
Subject: [ruby-changes:68106] 63297c2ca4 (master): Align the implementation precedences with `rb_atomic_t` definition
https://git.ruby-lang.org/ruby.git/commit/?id=63297c2ca4 From 63297c2ca494661bdf5536a3c5d3a1c8d68d2d64 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 24 Sep 2021 10:05:17 +0900 Subject: 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. --- include/ruby/atomic.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/ruby/atomic.h b/include/ruby/atomic.h index 07aa10c..3eb80fb 100644 --- a/include/ruby/atomic.h +++ b/include/ruby/atomic.h @@ -430,6 +430,9 @@ rbimpl_atomic_inc(volatile rb_atomic_t *ptr) https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L430 { #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) https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L453 { #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) https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L564 { #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) https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L587 { #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); -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/