To: vim_dev@googlegroups.com Subject: Patch 8.0.0638 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0638 Problem: Cannot build with new MSVC version VS2017. Solution: Change the compiler arguments. (Leonardo Manera, closes #1731, closes #1747) Files: src/GvimExt/Makefile, src/Make_mvc.mak *** ../vim-8.0.0637/src/GvimExt/Makefile 2016-10-12 14:19:55.734357838 +0200 --- src/GvimExt/Makefile 2017-06-13 15:18:43.024087680 +0200 *************** *** 1,11 **** # Makefile for GvimExt, using MSVC # Options: # DEBUG=yes Build debug version (for VC7 and maybe later) # ! TARGETOS=WINNT !ifndef APPVER ! APPVER=5.0 !endif !if "$(DEBUG)" != "yes" --- 1,14 ---- # Makefile for GvimExt, using MSVC # Options: # DEBUG=yes Build debug version (for VC7 and maybe later) + # CPUARG= /arch:IA32/AVX/etc, call from main makefile to set + # automatically from CPUNR # ! TARGETOS = WINNT ! !ifndef APPVER ! APPVER = 5.01 !endif !if "$(DEBUG)" != "yes" *************** *** 37,42 **** --- 40,48 ---- !include !endif + # include CPUARG + cflags = $(cflags) $(CPUARG) + all: gvimext.dll gvimext.dll: gvimext.obj \ *** ../vim-8.0.0637/src/Make_mvc.mak 2017-02-01 13:02:43.794603926 +0100 --- src/Make_mvc.mak 2017-06-13 15:18:43.024087680 +0200 *************** *** 1,7 **** # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64, # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98), # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010), ! # VC11 (VS2012), VC12 (VS2013) and VC14 (VS2015) # # To build using other Windows compilers, see INSTALLpc.txt # --- 1,7 ---- # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64, # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98), # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010), ! # VC11 (VS2012), VC12 (VS2013), VC14 (VS2015) and VC15 (VS2017) # # To build using other Windows compilers, see INSTALLpc.txt # *************** *** 108,117 **** # # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # ! # Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is ! # i386) ! # ! # Version Support: WINVER=[0x0501, 0x0600] (default is 0x0501) # # Debug version: DEBUG=yes # Mapfile: MAP=[no, yes or lines] (default is yes) --- 108,122 ---- # # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # ! # Processor Version: CPUNR=[any, i586, i686, sse, sse2, avx, avx2] (default is ! # any) ! # avx is available on Visual C++ 2010 and after. ! # avx2 is available on Visual C++ 2013 Update 2 and after. ! # ! # Version Support: WINVER=[0x0501, 0x0502, 0x0600, 0x0601, 0x0602, ! # 0x0603, 0x0A00] (default is 0x0501) ! # Supported versions depends on your target SDK, check SDKDDKVer.h ! # See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt # # Debug version: DEBUG=yes # Mapfile: MAP=[no, yes or lines] (default is yes) *************** *** 270,280 **** --- 275,305 ---- !if $(MSVCVER) < 1900 MSVC_MAJOR = ($(MSVCVER) / 100 - 6) MSVCRT_VER = ($(MSVCVER) / 10 - 60) + # Visual C++ 2017 needs special handling + # it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140 + !elseif $(MSVCVER) == 1910 + MSVC_MAJOR = 15 + MSVCRT_VER = 140 !else MSVC_MAJOR = ($(MSVCVER) / 100 - 5) MSVCRT_VER = ($(MSVCVER) / 10 - 50) !endif + # Calculate MSVC_FULL for Visual C++ 8 and up. + !if $(MSVC_MAJOR) >= 8 + ! if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul] + ! message *** ERROR + ! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. + ! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. + ! error Make aborted. + ! else + ! include msvcfullver.~ + ! if [del msvcfullver.c msvcfullver.~] + ! endif + ! endif + !endif + + # Calculate MSVCRT_VER !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 !include msvcrtver.~ *************** *** 446,472 **** INTDIR=$(OBJDIR) OUTDIR=$(OBJDIR) # Convert processor ID to MVC-compatible number !if $(MSVC_MAJOR) < 8 ! !if "$(CPUNR)" == "i386" ! CPUARG = /G3 ! !elseif "$(CPUNR)" == "i486" ! CPUARG = /G4 ! !elseif "$(CPUNR)" == "i586" CPUARG = /G5 ! !elseif "$(CPUNR)" == "i686" CPUARG = /G6 ! !elseif "$(CPUNR)" == "pentium4" CPUARG = /G7 /arch:SSE2 ! !else CPUARG = ! !endif !else ! # VC8/9/10 only allows specifying SSE architecture but only for 32bit ! !if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "pentium4" CPUARG = /arch:SSE2 !endif ! !endif LIBC = DEBUGINFO = /Zi --- 471,565 ---- INTDIR=$(OBJDIR) OUTDIR=$(OBJDIR) + ### Validate CPUNR + !ifndef CPUNR + # default to untargeted code + CPUNR = any + !elseif "$(CPUNR)" == "i386" || "$(CPUNR)" == "i486" + # alias i386 and i486 to i586 + ! message *** WARNING CPUNR=$(CPUNR) is not a valid target architecture. + ! message Windows XP is the minimum target OS, with a minimum target + ! message architecture of i586. + ! message Retargeting to i586 + CPUNR = i586 + !elseif "$(CPUNR)" == "pentium4" + # alias pentium4 to sse2 + ! message *** WARNING CPUNR=pentium4 is deprecated in favour of sse2. + ! message Retargeting to sse2. + CPUNR = sse2 + !elseif "$(CPUNR)" != "any" && "$(CPUNR)" != "i586" && "$(CPUNR)" != "i686" && "$(CPUNR)" != "sse" && "$(CPUNR)" != "sse2" && "$(CPUNR)" != "avx" && "$(CPUNR)" != "avx2" + ! error *** ERROR Unknown target architecture "$(CPUNR)". Make aborted. + !endif + # Convert processor ID to MVC-compatible number !if $(MSVC_MAJOR) < 8 ! ! if "$(CPUNR)" == "i586" CPUARG = /G5 ! ! elseif "$(CPUNR)" == "i686" CPUARG = /G6 ! ! elseif "$(CPUNR)" == "sse" ! CPUARG = /G6 /arch:SSE ! ! elseif "$(CPUNR)" == "sse2" CPUARG = /G7 /arch:SSE2 ! ! elseif "$(CPUNR)" == "avx" || "$(CPUNR)" == "avx2" ! ! message AVX/AVX2 Instruction Sets are not supported by Visual C++ v$(MSVC_MAJOR) ! ! message Falling back to SSE2 ! CPUARG = /G7 /arch:SSE2 ! ! elseif "$(CPUNR)" == "any" CPUARG = ! ! endif !else ! # IA32/SSE/SSE2 are only supported on x86 ! ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && ("$(CPUNR)" == "i586" || "$(CPUNR)" == "i686" || "$(CPUNR)" == "any") ! # VC<11 generates fp87 code by default ! ! if $(MSVC_MAJOR) < 11 ! CPUARG = ! # VC>=11 needs explicit insturctions to generate fp87 code ! ! else ! CPUARG = /arch:IA32 ! ! endif ! ! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse" ! CPUARG = /arch:SSE ! ! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse2" CPUARG = /arch:SSE2 + ! elseif "$(CPUNR)" == "avx" + # AVX is only supported by VC 10 and up + ! if $(MSVC_MAJOR) < 10 + ! message AVX Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR) + ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" + ! message Falling back to SSE2 + CPUARG = /arch:SSE2 + ! else + CPUARG = + ! endif + ! else + CPUARG = /arch:AVX + ! endif + ! elseif "$(CPUNR)" == "avx2" + # AVX is only supported by VC 10 and up + ! if $(MSVC_MAJOR) < 10 + ! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR) + ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" + ! message Falling back to SSE2 + CPUARG = /arch:SSE2 + ! else + CPUARG = + ! endif + # AVX2 is only supported by VC 12U2 and up + # 180030501 is the full version number for Visual Studio 2013/VC 12 Update 2 + ! elseif $(MSVC_FULL) < 180030501 + ! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL) + ! message Falling back to AVX + CPUARG = /arch:AVX + ! else + CPUARG = /arch:AVX2 + ! endif + ! endif !endif ! ! # Pass CPUARG to GVimExt, to avoid using version-dependent defaults ! MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)" ! LIBC = DEBUGINFO = /Zi *** ../vim-8.0.0637/src/version.c 2017-06-13 14:33:58.033066683 +0200 --- src/version.c 2017-06-13 15:21:02.499194381 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 638, /**/ -- hundred-and-one symptoms of being an internet addict: 30. Even though you died last week, you've managed to retain OPS on your favorite IRC channel. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///