Skip to content

Commit 1f2913e

Browse files
committed
Win32: Drop support for older than MSVC 14.0/_MSC_VER 1900
Visual C++ 2015 (14.0): - _MSC_VER: 1900 - MSVCRT_VERSION: 140
1 parent 7743123 commit 1f2913e

File tree

2 files changed

+13
-46
lines changed

2 files changed

+13
-46
lines changed

win32/Makefile.sub

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ CAT_DEPEND = type
132132

133133
!if !defined(MSC_VER)
134134
! error MSC_VER not defined. Retry from configure pass.
135-
!else if $(MSC_VER) < 1800
135+
!else if $(MSC_VER) < 1900
136136
! error MSVC $(MSC_VER) is not supported
137137
!endif
138138
!if !defined(MACHINE)
@@ -163,9 +163,7 @@ XCFLAGS = $(XCFLAGS) -Dmodular_gc_dir="$(modular_gc_dir)"
163163
!if !defined(OPTFLAGS)
164164
OPTFLAGS = -O2sy-
165165
!endif
166-
!if $(MSC_VER) >= 1900
167166
OPTFLAGS = $(OPTFLAGS) -Zc:inline
168-
!endif
169167
!if !defined(incflags)
170168
incflags =
171169
!endif
@@ -174,7 +172,7 @@ PLATFORM = mswin32
174172
!endif
175173
!if !defined(RT)
176174
!error RT not defined. Retry from configure pass.
177-
!else if $(RT_VER) < 120
175+
!else if $(RT_VER) < 140
178176
! error Runtime library $(RT_VER) is not supported
179177
!endif
180178
!ifndef NTVER
@@ -744,9 +742,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
744742
#define rb_uid_t int
745743
#define HAVE_STRUCT_STAT_ST_RDEV 1
746744
#define HAVE_STRUCT_TIMEVAL 1
747-
!if $(MSC_VER) >= 1900
748745
#define HAVE_STRUCT_TIMESPEC
749-
!endif
750746
#define HAVE_INTTYPES_H 1
751747
#define HAVE_STDINT_H 1
752748
#define HAVE_INT8_T 1
@@ -855,9 +851,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
855851
#define HAVE_SYSTEM 1
856852
#define HAVE_TZSET 1
857853
#define HAVE_UMASK 1
858-
!if $(RT_VER) > 120
859854
#define HAVE_QSORT_S
860-
!endif
861855
#define HAVE_TYPE_NET_LUID 1
862856
#define HAVE_NULLPTR 1
863857
#define SETPGRP_VOID 1

win32/win32.c

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
#undef __STRICT_ANSI__
2323

24-
/* Visual C++ 2013 (12.0):
25-
* - _MSC_VER: 1800
26-
* - MSVCRT_VERSION: 120
24+
/* Visual C++ 2015 (14.0):
25+
* - _MSC_VER: 1900
26+
* - MSVCRT_VERSION: 140
2727
*/
2828
#include "ruby/ruby.h"
2929
#include "ruby/encoding.h"
@@ -113,10 +113,8 @@ static char *w32_getenv(const char *name, UINT cp);
113113
#undef dup2
114114
#undef strdup
115115

116-
#if RUBY_MSVCRT_VERSION >= 140
117-
# define _filbuf _fgetc_nolock
118-
# define _flsbuf _fputc_nolock
119-
#endif
116+
#define _filbuf _fgetc_nolock
117+
#define _flsbuf _fputc_nolock
120118
#define enough_to_get(n) (--(n) >= 0)
121119
#define enough_to_put(n) (--(n) >= 0)
122120

@@ -2401,7 +2399,6 @@ rb_w32_closedir(DIR *dirp)
24012399
return 0;
24022400
}
24032401

2404-
#if RUBY_MSVCRT_VERSION >= 140
24052402
typedef struct {
24062403
union
24072404
{
@@ -2421,14 +2418,8 @@ typedef struct {
24212418
#define FILE_COUNT(stream) ((vcruntime_file*)stream)->_cnt
24222419
#define FILE_READPTR(stream) ((vcruntime_file*)stream)->_ptr
24232420
#define FILE_FILENO(stream) ((vcruntime_file*)stream)->_file
2424-
#else
2425-
#define FILE_COUNT(stream) stream->_cnt
2426-
#define FILE_READPTR(stream) stream->_ptr
2427-
#define FILE_FILENO(stream) stream->_file
2428-
#endif
24292421

24302422
/* License: Ruby's */
2431-
#if RUBY_MSVCRT_VERSION >= 140
24322423
typedef char lowio_text_mode;
24332424
typedef char lowio_pipe_lookahead[3];
24342425

@@ -2445,30 +2436,14 @@ typedef struct {
24452436
uint8_t dbcsBufferUsed : 1; // Is the dbcsBuffer in use?
24462437
char dbcsBuffer; // Buffer for the lead byte of DBCS when converting from DBCS to Unicode
24472438
} ioinfo;
2448-
#else
2449-
typedef struct {
2450-
intptr_t osfhnd; /* underlying OS file HANDLE */
2451-
char osfile; /* attributes of file (e.g., open in text mode?) */
2452-
char pipech; /* one char buffer for handles opened on pipes */
2453-
int lockinitflag;
2454-
CRITICAL_SECTION lock;
2455-
char textmode;
2456-
char pipech2[2];
2457-
} ioinfo;
2458-
#endif
24592439

24602440
#if !defined _CRTIMP || defined __MINGW32__
24612441
#undef _CRTIMP
24622442
#define _CRTIMP __declspec(dllimport)
24632443
#endif
24642444

2465-
#if RUBY_MSVCRT_VERSION >= 140
24662445
static ioinfo ** __pioinfo = NULL;
24672446
#define IOINFO_L2E 6
2468-
#else
2469-
EXTERN_C _CRTIMP ioinfo * __pioinfo[];
2470-
#define IOINFO_L2E 5
2471-
#endif
24722447
static inline ioinfo* _pioinfo(int);
24732448

24742449

@@ -2484,13 +2459,12 @@ static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
24842459
static void
24852460
set_pioinfo_extra(void)
24862461
{
2487-
#if RUBY_MSVCRT_VERSION >= 140
2488-
# define FUNCTION_RET 0xc3 /* ret */
2489-
# ifdef _DEBUG
2490-
# define UCRTBASE "ucrtbased.dll"
2491-
# else
2492-
# define UCRTBASE "ucrtbase.dll"
2493-
# endif
2462+
#define FUNCTION_RET 0xc3 /* ret */
2463+
#ifdef _DEBUG
2464+
# define UCRTBASE "ucrtbased.dll"
2465+
#else
2466+
# define UCRTBASE "ucrtbase.dll"
2467+
#endif
24942468
/* get __pioinfo addr with _isatty */
24952469
/*
24962470
* Why Ruby depends to _pioinfo is
@@ -2625,7 +2599,6 @@ set_pioinfo_extra(void)
26252599
__pioinfo = *(ioinfo***)(p);
26262600
#endif
26272601
#endif /* _M_ARM64 */
2628-
#endif /* RUBY_MSVCRT_VERSION */
26292602
int fd;
26302603

26312604
fd = _open("NUL", O_RDONLY);

0 commit comments

Comments
 (0)