ruby-changes:64551
From: Nobuyoshi <ko1@a...>
Date: Thu, 24 Dec 2020 16:23:16 +0900 (JST)
Subject: [ruby-changes:64551] b343d54792 (master): Use RBIMPL_COMPILER_{SINCE, BEFORE} for MSVC
https://git.ruby-lang.org/ruby.git/commit/?id=b343d54792 From b343d547923cf29456910b20fcd1c0a58ed68176 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 24 Dec 2020 16:16:20 +0900 Subject: Use RBIMPL_COMPILER_{SINCE,BEFORE} for MSVC Pointed out by @shyouhei. NOTE: Already we have dropped the support for older MSVCs, probably prior to 1300 or 1400. Remove the conditional code, especially in win32/Makefile.sub. diff --git a/include/ruby/atomic.h b/include/ruby/atomic.h index 39006bc..a898c30 100644 --- a/include/ruby/atomic.h +++ b/include/ruby/atomic.h @@ -36,7 +36,7 @@ typedef unsigned int rb_atomic_t; /* Anything OK */ https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L36 # define RUBY_ATOMIC_GENERIC_MACRO 1 #elif defined _WIN32 -#if MSC_VERSION_SINCE(1300) +#if RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0) #pragma intrinsic(_InterlockedOr) #endif typedef LONG rb_atomic_t; @@ -48,7 +48,7 @@ typedef LONG rb_atomic_t; https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L48 # define RUBY_ATOMIC_FETCH_SUB(var, val) InterlockedExchangeAdd(&(var), -(LONG)(val)) #if defined __GNUC__ # define RUBY_ATOMIC_OR(var, val) __asm__("lock\n\t" "orl\t%1, %0" : "=m"(var) : "Ir"(val)) -#elif MSC_VERSION_BEFORE(1300) +#elif RBIMPL_COMPILER_BEFORE(MSVC, 13, 0, 0) # define RUBY_ATOMIC_OR(var, val) rb_w32_atomic_or(&(var), (val)) static inline void rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val) @@ -66,7 +66,7 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val) https://github.com/ruby/ruby/blob/trunk/include/ruby/atomic.h#L66 #endif # define RUBY_ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val)) # define RUBY_ATOMIC_CAS(var, oldval, newval) InterlockedCompareExchange(&(var), (newval), (oldval)) -# if MSC_VERSION_BEFORE(1300) +# if RBIMPL_COMPILER_BEFORE(MSVC, 13, 0, 0) static inline rb_atomic_t rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/