Deprecate old VC

This commit is contained in:
Nobuyoshi Nakada 2024-10-24 19:35:05 +09:00
parent 0b65ac6daf
commit 4c07e61bc9
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-12-26 07:04:46 +00:00
10 changed files with 16 additions and 50 deletions

View File

@ -34,7 +34,7 @@
# include <sys/types.h> /* ssize_t */
#endif
#if RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0)
#if RBIMPL_COMPILER_IS(MSVC)
# pragma intrinsic(_InterlockedOr)
#elif defined(__sun) && defined(HAVE_ATOMIC_H)
# include <atomic.h>
@ -790,22 +790,9 @@ rbimpl_atomic_or(volatile rb_atomic_t *ptr, rb_atomic_t val, int memory_order)
#elif defined(HAVE_GCC_SYNC_BUILTINS)
__sync_or_and_fetch(ptr, val);
#elif RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0)
#elif RBIMPL_COMPILER_IS(MSVC)
_InterlockedOr(ptr, val);
#elif defined(_WIN32) && defined(__GNUC__)
/* This was for old MinGW. Maybe not needed any longer? */
__asm__(
"lock\n\t"
"orl\t%1, %0"
: "=m"(ptr)
: "Ir"(val));
#elif defined(_WIN32) && defined(_M_IX86)
__asm mov eax, ptr;
__asm mov ecx, val;
__asm lock or [eax], ecx;
#elif defined(__sun) && defined(HAVE_ATOMIC_H)
atomic_or_uint(ptr, val);
@ -817,15 +804,6 @@ rbimpl_atomic_or(volatile rb_atomic_t *ptr, rb_atomic_t val, int memory_order)
#endif
}
/* Nobody uses this but for theoretical backwards compatibility... */
#if RBIMPL_COMPILER_BEFORE(MSVC, 13, 0, 0)
static inline rb_atomic_t
rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
{
return rbimpl_atomic_or(var, val);
}
#endif
RBIMPL_ATTR_ARTIFICIAL()
RBIMPL_ATTR_NOALIAS()
RBIMPL_ATTR_NONNULL((1))
@ -1031,16 +1009,9 @@ rbimpl_atomic_cas(volatile rb_atomic_t *ptr, rb_atomic_t oldval, rb_atomic_t new
#elif defined(HAVE_GCC_SYNC_BUILTINS)
return __sync_val_compare_and_swap(ptr, oldval, newval);
#elif RBIMPL_COMPILER_SINCE(MSVC, 13, 0, 0)
#elif RBIMPL_COMPILER_IS(MSVC)
return InterlockedCompareExchange(ptr, newval, oldval);
#elif defined(_WIN32)
PVOID *pptr = RBIMPL_CAST((PVOID *)ptr);
PVOID pold = RBIMPL_CAST((PVOID)oldval);
PVOID pnew = RBIMPL_CAST((PVOID)newval);
PVOID pret = InterlockedCompareExchange(pptr, pnew, pold);
return RBIMPL_CAST((rb_atomic_t)pret);
#elif defined(__sun) && defined(HAVE_ATOMIC_H)
return atomic_cas_uint(ptr, oldval, newval);
@ -1054,15 +1025,6 @@ rbimpl_atomic_cas(volatile rb_atomic_t *ptr, rb_atomic_t oldval, rb_atomic_t new
#endif
}
/* Nobody uses this but for theoretical backwards compatibility... */
#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)
{
return rbimpl_atomic_cas(var, oldval, newval);
}
#endif
RBIMPL_ATTR_ARTIFICIAL()
RBIMPL_ATTR_NOALIAS()
RBIMPL_ATTR_NONNULL((1))

View File

@ -48,7 +48,7 @@
#elif RBIMPL_HAS_ATTRIBUTE(deprecated) /* but not with message. */
# define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__))
#elif RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0)
#elif RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_ATTR_DEPRECATED(msg) __declspec(deprecated msg)
#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(deprecated)

View File

@ -29,7 +29,7 @@
* `__forceinline` are mutually exclusive. We have to mimic that behaviour for
* non-MSVC compilers.
*/
#if RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0)
#if RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_ATTR_FORCEINLINE() __forceinline
#elif RBIMPL_HAS_ATTRIBUTE(always_inline)
# define RBIMPL_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline

View File

@ -78,7 +78,7 @@
#elif defined(__INTEL_CXX11_MODE__)
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
#elif RBIMPL_COMPILER_SINCE(MSVC, 19, 0, 0)
#elif RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
#elif __cplusplus >= 201103L

View File

@ -28,7 +28,7 @@
* `__has_declspec_attribute()` which involves macro substitution. */
/** Wraps (or simulates) `__declspec(restrict)` */
#if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0)
#if RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_ATTR_RESTRICT() __declspec(re ## strict)
#elif RBIMPL_HAS_ATTRIBUTE(malloc)

View File

@ -50,7 +50,7 @@
# define HAVE_VA_ARGS_MACRO
# elif defined(__INTEL_CXX11_MODE__)
# define HAVE_VA_ARGS_MACRO
# elif RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
# elif RBIMPL_COMPILER_IS(MSVC)
# define HAVE_VA_ARGS_MACRO
# else
# /* NG, not known. */

View File

@ -30,7 +30,7 @@
# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */
# define RBIMPL_STATIC_ASSERT0 static_assert
#elif defined(__cplusplus) && RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
#elif defined(__cplusplus) && RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_STATIC_ASSERT0 static_assert
#elif defined(__INTEL_CXX11_MODE__)

View File

@ -79,7 +79,7 @@
*/
#define RBIMPL_WARNING_IGNORED(flag) __pragma(warning(disable: flag))
#elif RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0)
#elif RBIMPL_COMPILER_IS(MSVC)
# /* Not sure exactly when but it seems VC++ 6.0 is a version with it.*/
# define RBIMPL_WARNING_PUSH() __pragma(warning(push))
# define RBIMPL_WARNING_POP() __pragma(warning(pop))

View File

@ -79,7 +79,7 @@ PRINTF_ARGS(void rb_warn_reserved_name(const char *removal, const char *fmt, ...
# define RUBY_VERSION_BEFORE(major, minor) (RUBY_API_VERSION_CODE < (major * 10000) + (minor) * 100)
# if defined(RBIMPL_WARNING_PRAGMA0)
# define RBIMPL_TODO0(x) RBIMPL_WARNING_PRAGMA0(message(x))
# elif RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0)
# elif RBIMPL_COMPILER_IS(MSVC)
# define RBIMPL_TODO0(x) __pragma(message(x))
# endif

View File

@ -188,12 +188,16 @@ echo TEENY = RUBY_VERSION_TEENY
echo ABI_VERSION = RUBY_ABI_VERSION
#endif
set /a MSC_VER = _MSC_VER
#if _MSC_VER >= 1920
#ifndef _MSC_VER
# error _MSC_VER not defined
#elif _MSC_VER >= 1920
set /a MSC_VER_LOWER = MSC_VER/20*20+0
set /a MSC_VER_UPPER = MSC_VER/20*20+19
#elif _MSC_VER >= 1900
set /a MSC_VER_LOWER = MSC_VER/10*10+0
set /a MSC_VER_UPPER = MSC_VER/10*10+9
#elif _MSC_VER < 1400
# error Unsupported VC++ compiler
#endif
set MSC_VER
del %0 & exit