changeset 27342:41a940219183 v8.2.4199

patch 8.2.4199: MS-Windows: Support for MSVC 2003 is not useful Commit: https://github.com/vim/vim/commit/c351dc1e0ca959084ba36bb350291334bf74b9f8 Author: K.Takata <kentkt@csc.jp> Date: Mon Jan 24 11:24:08 2022 +0000 patch 8.2.4199: MS-Windows: Support for MSVC 2003 is not useful Problem: MS-Windows: Support for MSVC 2003 is not useful. Solution: Remove the exceptions for MSVC 2003. (Ken Takata, closes https://github.com/vim/vim/issues/9616)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Jan 2022 12:30:04 +0100
parents fd8ea6ceff93
children 477e3f07cab2
files src/GvimExt/gvimext.h src/ex_docmd.c src/feature.h src/gui_w32.c src/if_cscope.c src/if_ole.cpp src/if_ruby.c src/macros.h src/os_mswin.c src/os_win32.c src/os_win32.h src/proto/os_win32.pro src/time.c src/version.c src/vim.h
diffstat 15 files changed, 31 insertions(+), 199 deletions(-) [+]
line wrap: on
line diff
--- a/src/GvimExt/gvimext.h
+++ b/src/GvimExt/gvimext.h
@@ -44,12 +44,6 @@
 #include <shlobj.h>
 #include <wchar.h>
 
-/* Accommodate old versions of VC that don't have a modern Platform SDK */
-#if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
-# undef  UINT_PTR
-# define UINT_PTR UINT
-#endif
-
 #define ResultFromShort(i)  ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
 
 // Initialize GUIDs (should be done only and at-least once per DLL/EXE)
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1716,12 +1716,6 @@ comment_start(char_u *p, int starts_with
  *
  * This function may be called recursively!
  */
-#if (_MSC_VER == 1200)
-/*
- * Avoid optimisation bug in VC++ version 6.0
- */
- #pragma optimize( "g", off )
-#endif
     static char_u *
 do_one_cmd(
     char_u	**cmdlinep,
@@ -2648,9 +2642,6 @@ doend:
 
     return ea.nextcmd;
 }
-#if (_MSC_VER == 1200)
- #pragma optimize( "", on )
-#endif
 
 static char ex_error_buf[MSG_BUF_LEN];
 
--- a/src/feature.h
+++ b/src/feature.h
@@ -629,8 +629,7 @@
     && (defined(FEAT_GUI_GTK) \
 	|| (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \
 	|| defined(FEAT_GUI_HAIKU) \
-	|| (defined(FEAT_GUI_MSWIN) \
-	    && (!defined(_MSC_VER) || _MSC_VER > 1020)))
+	|| defined(FEAT_GUI_MSWIN))
 # define FEAT_GUI_TABLINE
 #endif
 
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -4031,13 +4031,6 @@ gui_mch_browsedir(char_u *title, char_u 
 # define ID_BEVAL_TOOLTIP   200
 # define BEVAL_TEXT_LEN	    MAXPATHL
 
-# if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
-// Work around old versions of basetsd.h which wrongly declares
-// UINT_PTR as unsigned long.
-#  undef  UINT_PTR
-#  define UINT_PTR UINT
-# endif
-
 static BalloonEval  *cur_beval = NULL;
 static UINT_PTR	    BevalTimerId = 0;
 static DWORD	    LastActivity = 0;
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -838,11 +838,6 @@ cs_create_connection(int i)
     HANDLE	stdin_rd, stdout_rd;
     HANDLE	stdout_wr, stdin_wr;
     BOOL	created;
-# if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
-#  define OPEN_OH_ARGTYPE intptr_t
-# else
-#  define OPEN_OH_ARGTYPE long
-# endif
 #endif
 
 #if defined(UNIX)
@@ -1037,11 +1032,11 @@ err_closing:
     CloseHandle(pi.hThread);
 
     // TODO - tidy up after failure to create files on pipe handles.
-    if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdin_wr,
+    if (((fd = _open_osfhandle((intptr_t)stdin_wr,
 						      _O_TEXT|_O_APPEND)) < 0)
 	    || ((csinfo[i].to_fp = _fdopen(fd, "w")) == NULL))
 	PERROR(_("cs_create_connection: fdopen for to_fp failed"));
-    if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdout_rd,
+    if (((fd = _open_osfhandle((intptr_t)stdout_rd,
 						      _O_TEXT|_O_RDONLY)) < 0)
 	    || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL))
 	PERROR(_("cs_create_connection: fdopen for fr_fp failed"));
--- a/src/if_ole.cpp
+++ b/src/if_ole.cpp
@@ -30,13 +30,6 @@ extern HWND vim_parent_hwnd;
 # define FINAL
 #endif
 
-#if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
-/* Work around old versions of basetsd.h which wrongly declares
- * UINT_PTR as unsigned long */
-# undef UINT_PTR
-# define UINT_PTR UINT
-#endif
-
 #include "if_ole.h"	// Interface definitions
 #include "iid_ole.c"	// UUID definitions (compile here)
 
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -32,11 +32,6 @@
 # define RUBYEXTERN extern
 #endif
 
-// suggested by Ariya Mizutani
-#if (_MSC_VER == 1200)
-# undef _WIN32_WINNT
-#endif
-
 #ifdef DYNAMIC_RUBY
 /*
  * This is tricky.  In ruby.h there is (inline) function rb_class_of()
--- a/src/macros.h
+++ b/src/macros.h
@@ -166,9 +166,9 @@
 #   define mch_access(n, p)	access((n), (p))
 # endif
 
-// Use 64-bit fstat function if available.
+// Use 64-bit fstat function on MS-Windows.
 // NOTE: This condition is the same as for the stat_T type.
-# if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
+# ifdef MSWIN
 #  define mch_fstat(n, p)	_fstat64((n), (p))
 # else
 #  define mch_fstat(n, p)	fstat((n), (p))
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -429,23 +429,15 @@ slash_adjust(char_u *p)
     }
 }
 
-// Use 64-bit stat functions if available.
-#ifdef HAVE_STAT64
-# undef stat
-# undef _stat
-# undef _wstat
-# undef _fstat
-# define stat _stat64
-# define _stat _stat64
-# define _wstat _wstat64
-# define _fstat _fstat64
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
-# define OPEN_OH_ARGTYPE intptr_t
-#else
-# define OPEN_OH_ARGTYPE long
-#endif
+// Use 64-bit stat functions.
+#undef stat
+#undef _stat
+#undef _wstat
+#undef _fstat
+#define stat _stat64
+#define _stat _stat64
+#define _wstat _wstat64
+#define _fstat _fstat64
 
     static int
 wstat_symlink_aware(const WCHAR *name, stat_T *stp)
@@ -487,7 +479,7 @@ wstat_symlink_aware(const WCHAR *name, s
 	{
 	    int	    fd;
 
-	    fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
+	    fd = _open_osfhandle((intptr_t)h, _O_RDONLY);
 	    n = _fstat(fd, (struct _stat *)stp);
 	    if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY))
 		stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR;
@@ -881,7 +873,7 @@ mch_libcall(
 	__except(EXCEPTION_EXECUTE_HANDLER)
 	{
 	    if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW)
-		RESETSTKOFLW();
+		_resetstkoflw();
 	    fRunTimeLinkSuccess = 0;
 	}
 # endif
@@ -1043,14 +1035,7 @@ swap_me(COLORREF colorref)
     return colorref;
 }
 
-// Attempt to make this work for old and new compilers
-# if !defined(_WIN64) && (!defined(_MSC_VER) || _MSC_VER < 1300)
-#  define PDP_RETVAL BOOL
-# else
-#  define PDP_RETVAL INT_PTR
-# endif
-
-    static PDP_RETVAL CALLBACK
+    static INT_PTR CALLBACK
 PrintDlgProc(
 	HWND hDlg,
 	UINT message,
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -7464,88 +7464,6 @@ mch_copy_file_attribute(char_u *from, ch
     return 0;
 }
 
-#if defined(MYRESETSTKOFLW) || defined(PROTO)
-/*
- * Recreate a destroyed stack guard page in win32.
- * Written by Benjamin Peterson.
- */
-
-// These magic numbers are from the MS header files
-# define MIN_STACK_WINNT 2
-
-/*
- * This function does the same thing as _resetstkoflw(), which is only
- * available in DevStudio .net and later.
- * Returns 0 for failure, 1 for success.
- */
-    int
-myresetstkoflw(void)
-{
-    BYTE	*pStackPtr;
-    BYTE	*pGuardPage;
-    BYTE	*pStackBase;
-    BYTE	*pLowestPossiblePage;
-    MEMORY_BASIC_INFORMATION mbi;
-    SYSTEM_INFO si;
-    DWORD	nPageSize;
-    DWORD	dummy;
-
-    // We need to know the system page size.
-    GetSystemInfo(&si);
-    nPageSize = si.dwPageSize;
-
-    // ...and the current stack pointer
-    pStackPtr = (BYTE*)_alloca(1);
-
-    // ...and the base of the stack.
-    if (VirtualQuery(pStackPtr, &mbi, sizeof mbi) == 0)
-	return 0;
-    pStackBase = (BYTE*)mbi.AllocationBase;
-
-    // ...and the page that's min_stack_req pages away from stack base; this is
-    // the lowest page we could use.
-    pLowestPossiblePage = pStackBase + MIN_STACK_WINNT * nPageSize;
-
-    {
-	// We want the first committed page in the stack Start at the stack
-	// base and move forward through memory until we find a committed block.
-	BYTE *pBlock = pStackBase;
-
-	for (;;)
-	{
-	    if (VirtualQuery(pBlock, &mbi, sizeof mbi) == 0)
-		return 0;
-
-	    pBlock += mbi.RegionSize;
-
-	    if (mbi.State & MEM_COMMIT)
-		break;
-	}
-
-	// mbi now describes the first committed block in the stack.
-	if (mbi.Protect & PAGE_GUARD)
-	    return 1;
-
-	// decide where the guard page should start
-	if ((long_u)(mbi.BaseAddress) < (long_u)pLowestPossiblePage)
-	    pGuardPage = pLowestPossiblePage;
-	else
-	    pGuardPage = (BYTE*)mbi.BaseAddress;
-
-	// allocate the guard page
-	if (!VirtualAlloc(pGuardPage, nPageSize, MEM_COMMIT, PAGE_READWRITE))
-	    return 0;
-
-	// apply the guard attribute to the page
-	if (!VirtualProtect(pGuardPage, nPageSize, PAGE_READWRITE | PAGE_GUARD,
-								      &dummy))
-	    return 0;
-    }
-
-    return 1;
-}
-#endif
-
 
 /*
  * The command line arguments in UTF-16
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -47,13 +47,8 @@
 
 #define FEAT_SHORTCUT		// resolve shortcuts
 
-#if (!defined(_MSC_VER) || _MSC_VER > 1020)
-/*
- * Access Control List (actually security info).
- * MSVC has acl stuff only in 5.0, not in 4.2, don't know about 4.3.
- */
-# define HAVE_ACL
-#endif
+// Access Control List (actually security info).
+#define HAVE_ACL
 
 #define USE_FNAME_CASE		// adjust case of file names
 #if !defined(FEAT_CLIPBOARD)
@@ -134,17 +129,11 @@
 # define IO_REPARSE_TAG_SYMLINK		0xA000000C
 #endif
 
-#if defined(_MSC_VER)
+#ifdef _MSC_VER
     // Support for __try / __except.  All versions of MSVC are
     // expected to have this.  Any other compilers that support it?
 # define HAVE_TRY_EXCEPT 1
 # include <malloc.h>		// for _resetstkoflw()
-# if defined(_MSC_VER) && (_MSC_VER >= 1300)
-#  define RESETSTKOFLW _resetstkoflw
-# else
-#  define RESETSTKOFLW myresetstkoflw
-#  define MYRESETSTKOFLW
-# endif
 #endif
 
 /*
@@ -154,14 +143,8 @@
 
 #ifdef _DEBUG
 
-# if defined(_MSC_VER)	&&  (_MSC_VER >= 1000)
-   // Use the new debugging tools in Visual C++ 4.x
-#  include <crtdbg.h>
-#  define ASSERT(f) _ASSERT(f)
-# else
-#  include <assert.h>
-#  define ASSERT(f) assert(f)
-# endif
+# include <crtdbg.h>
+# define ASSERT(f) _ASSERT(f)
 
 # define TRACE			Trace
 # define TRACE0(sz)		Trace(_T("%s"), _T(sz))
--- a/src/proto/os_win32.pro
+++ b/src/proto/os_win32.pro
@@ -64,7 +64,6 @@ int mch_access(char *n, int p);
 int mch_open(const char *name, int flags, int mode);
 FILE *mch_fopen(const char *name, const char *mode);
 int mch_copy_file_attribute(char_u *from, char_u *to);
-int myresetstkoflw(void);
 int get_cmd_argsW(char ***argvp);
 void free_cmd_argsW(void);
 void used_file_arg(char *name, int literal, int full_path, int diff_mode);
--- a/src/time.c
+++ b/src/time.c
@@ -1022,14 +1022,6 @@ get8ctime(FILE *fd)
     return n;
 }
 
-#ifdef _MSC_VER
-# if (_MSC_VER <= 1200)
-// This line is required for VC6 without the service pack.  Also see the
-// matching #pragma below.
- #  pragma optimize("", off)
-# endif
-#endif
-
 /*
  * Write time_T to file "fd" in 8 bytes.
  * Returns FAIL when the write failed.
@@ -1068,22 +1060,16 @@ time_to_bytes(time_T the_time, char_u *b
 	    buf[bi++] = 0;
 	else
 	{
-#if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4
+# if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4
 	    c = (int)(wtime >> (i * 8));
-#else
+# else
 	    c = (int)((long_u)wtime >> (i * 8));
-#endif
+# endif
 	    buf[bi++] = c;
 	}
     }
 }
 
-#ifdef _MSC_VER
-# if (_MSC_VER <= 1200)
- #  pragma optimize("", on)
-# endif
-#endif
-
 #endif
 
 /*
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4199,
+/**/
     4198,
 /**/
     4197,
--- a/src/vim.h
+++ b/src/vim.h
@@ -356,7 +356,7 @@ typedef		 __int64	long_i;
   // that change size between 32-bit and 64-bit platforms.  For any such type,
   // __w64 should appear only on the 32-bit definition of the typedef.
   // Define __w64 as an empty token for everything but MSVC 7.x or later.
-# if !defined(_MSC_VER)	|| (_MSC_VER < 1300)
+# ifndef _MSC_VER
 #  define __w64
 # endif
 typedef unsigned long __w64	long_u;
@@ -383,7 +383,7 @@ typedef		 long __w64     long_i;
  * We assume that when fseeko() is available then ftello() is too.
  * Note that Windows has different function names.
  */
-#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
+#ifdef MSWIN
 typedef __int64 off_T;
 # ifdef __MINGW32__
 #  define vim_lseek lseek64
@@ -2162,9 +2162,8 @@ typedef struct
 typedef int Clipboard_T;	// This is required for the prototypes.
 #endif
 
-// Use 64-bit stat structure if available.
-#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
-# define HAVE_STAT64
+// Use 64-bit stat structure on MS-Windows.
+#ifdef MSWIN
 typedef struct _stat64 stat_T;
 #else
 typedef struct stat stat_T;