Project

General

Profile

Feature #16763

MSVC: allow ranges for MSVC 2017 and 2019 support in win32/Makefile.sub

Added by jmarrec (Julien Marrec) about 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:97732]

Description

_MSC_VER differs from previous version in 2017 and 2019, in the sense that updates have their own last digit changing.

For a list of _MSC_VER see for example https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd

config.h ends up having harcoded version (eg: 1924), which is overly strict (today I updated to MSVC update 16.5.1 and suddenly my build which links to and embeds ruby broke).

The proposed patch adds ranges for these version.


Files

#1

Updated by jmarrec (Julien Marrec) about 2 months ago

  • Subject changed from MSVC: allow ranges for MSVC 2017 and 2019 support in win/Makefile.sub to MSVC: allow ranges for MSVC 2017 and 2019 support in win32/Makefile.sub

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

  • Description updated (diff)
  1. Are they completely binary compatible?

  2. Only the last digit changes?
    If it is expected from now on, I prefer to avoid hardcoding the list in Makefile.sub.


diff --git c/win32/Makefile.sub w/win32/Makefile.sub
index 328f3479aa..ebe741d2e0 100644
--- c/win32/Makefile.sub
+++ w/win32/Makefile.sub
@@ -607,9 +607,15 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
    @$(IFCHANGE) "--timestamp=$(@:/=\)" $(RUBY_CONFIG_H:/=\) <<
 #ifndef $(guard)
 #define $(guard) 1
+!ifdef MSC_VER_RANGE
+#if (_MSC_VER / 10) != ($(MSC_VER) / 10)
+#error MSC version unmatch: $(MSC_VER_RANGE) is expected.
+#endif
+!else
 #if _MSC_VER != $(MSC_VER)
-#error MSC version unmatch: _MSC_VER: $(MSC_VER) is expected.
+#error MSC version unmatch: $(MSC_VER) is expected.
 #endif
+!endif
 #define RUBY_MSVCRT_VERSION $(RT_VER)
 #define STDC_HEADERS 1
 #define HAVE_SYS_TYPES_H 1
diff --git c/win32/setup.mak w/win32/setup.mak
index d67b6843a4..5cbbf12560 100644
--- c/win32/setup.mak
+++ w/win32/setup.mak
@@ -132,9 +132,6 @@ int main(void) {return (EnumProcesses(NULL,0,NULL) ? 0 : 1);}
 <<

 -version-: nul verconf.mk
-   @$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(MAKEFILE)" | findstr "=" >>$(MAKEFILE)
-MSC_VER = _MSC_VER
-<<

 verconf.mk: nul
    @$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(@)" > $(*F).bat && cmd /c $(*F).bat > $(@)
@@ -152,6 +149,11 @@ echo TEENY = RUBY_VERSION_TEENY
 #if defined RUBY_PATCHLEVEL && RUBY_PATCHLEVEL < 0
 echo RUBY_DEVEL = yes
 #endif
+echo MSC_VER = _MSC_VER
+#if _MSC_VER > 1900
+set /a v=_MSC_VER/10
+echo MSC_VER_RANGE = %v%0..%v%9
+#endif
 del %0 & exit
 <<

#3

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|93edbb4c08856d6d10d0e2676cc2e36eef839a7d.


Support version ranges for MSVC [Feature #16763]

Also available in: Atom PDF