To: vim_dev@googlegroups.com Subject: Patch 8.2.4199 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4199 Problem: MS-Windows: Support for MSVC 2003 is not useful. Solution: Remove the exceptions for MSVC 2003. (Ken Takata, closes #9616) 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/vim.h *** ../vim-8.2.4198/src/GvimExt/gvimext.h 2021-12-22 15:17:43.258403793 +0000 --- src/GvimExt/gvimext.h 2022-01-24 11:12:27.441341972 +0000 *************** *** 44,55 **** #include #include - /* 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) --- 44,49 ---- *** ../vim-8.2.4198/src/ex_docmd.c 2022-01-19 20:48:33.496661246 +0000 --- src/ex_docmd.c 2022-01-24 11:12:27.445341894 +0000 *************** *** 1716,1727 **** * * 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, --- 1716,1721 ---- *************** *** 2648,2656 **** return ea.nextcmd; } - #if (_MSC_VER == 1200) - #pragma optimize( "", on ) - #endif static char ex_error_buf[MSG_BUF_LEN]; --- 2642,2647 ---- *** ../vim-8.2.4198/src/feature.h 2022-01-08 13:36:24.134742355 +0000 --- src/feature.h 2022-01-24 11:12:27.445341894 +0000 *************** *** 629,636 **** && (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))) # define FEAT_GUI_TABLINE #endif --- 629,635 ---- && (defined(FEAT_GUI_GTK) \ || (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \ || defined(FEAT_GUI_HAIKU) \ ! || defined(FEAT_GUI_MSWIN)) # define FEAT_GUI_TABLINE #endif *** ../vim-8.2.4198/src/gui_w32.c 2022-01-23 16:25:13.939411326 +0000 --- src/gui_w32.c 2022-01-24 11:12:27.445341894 +0000 *************** *** 4031,4043 **** # 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; --- 4031,4036 ---- *** ../vim-8.2.4198/src/if_cscope.c 2022-01-13 18:09:08.245764844 +0000 --- src/if_cscope.c 2022-01-24 11:12:27.445341894 +0000 *************** *** 838,848 **** 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) --- 838,843 ---- *************** *** 1037,1047 **** CloseHandle(pi.hThread); // TODO - tidy up after failure to create files on pipe handles. ! if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)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, _O_TEXT|_O_RDONLY)) < 0) || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL)) PERROR(_("cs_create_connection: fdopen for fr_fp failed")); --- 1032,1042 ---- CloseHandle(pi.hThread); // TODO - tidy up after failure to create files on pipe handles. ! 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((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")); *** ../vim-8.2.4198/src/if_ole.cpp 2020-12-18 18:49:52.341571870 +0000 --- src/if_ole.cpp 2022-01-24 11:12:27.445341894 +0000 *************** *** 30,42 **** # 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) --- 30,35 ---- *** ../vim-8.2.4198/src/if_ruby.c 2022-01-07 20:01:04.060733978 +0000 --- src/if_ruby.c 2022-01-24 11:12:27.445341894 +0000 *************** *** 32,42 **** # 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() --- 32,37 ---- *** ../vim-8.2.4198/src/macros.h 2021-08-02 18:10:30.957721094 +0100 --- src/macros.h 2022-01-24 11:12:27.445341894 +0000 *************** *** 166,174 **** # define mch_access(n, p) access((n), (p)) # endif ! // Use 64-bit fstat function if available. // NOTE: This condition is the same as for the stat_T type. ! # if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__) # define mch_fstat(n, p) _fstat64((n), (p)) # else # define mch_fstat(n, p) fstat((n), (p)) --- 166,174 ---- # define mch_access(n, p) access((n), (p)) # endif ! // Use 64-bit fstat function on MS-Windows. // NOTE: This condition is the same as for the stat_T type. ! # ifdef MSWIN # define mch_fstat(n, p) _fstat64((n), (p)) # else # define mch_fstat(n, p) fstat((n), (p)) *** ../vim-8.2.4198/src/os_mswin.c 2022-01-21 11:37:03.640642885 +0000 --- src/os_mswin.c 2022-01-24 11:12:27.445341894 +0000 *************** *** 429,451 **** } } ! // 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 static int wstat_symlink_aware(const WCHAR *name, stat_T *stp) --- 429,443 ---- } } ! // 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,493 **** { int fd; ! fd = _open_osfhandle((OPEN_OH_ARGTYPE)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; --- 479,485 ---- { int fd; ! 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,887 **** __except(EXCEPTION_EXECUTE_HANDLER) { if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW) ! RESETSTKOFLW(); fRunTimeLinkSuccess = 0; } # endif --- 873,879 ---- __except(EXCEPTION_EXECUTE_HANDLER) { if (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW) ! _resetstkoflw(); fRunTimeLinkSuccess = 0; } # endif *************** *** 1043,1056 **** 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 PrintDlgProc( HWND hDlg, UINT message, --- 1035,1041 ---- return colorref; } ! static INT_PTR CALLBACK PrintDlgProc( HWND hDlg, UINT message, *** ../vim-8.2.4198/src/os_win32.c 2022-01-21 11:37:03.640642885 +0000 --- src/os_win32.c 2022-01-24 11:12:27.449341813 +0000 *************** *** 7464,7551 **** 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 --- 7464,7469 ---- *** ../vim-8.2.4198/src/os_win32.h 2022-01-21 11:37:03.640642885 +0000 --- src/os_win32.h 2022-01-24 11:12:27.449341813 +0000 *************** *** 47,59 **** #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 #define USE_FNAME_CASE // adjust case of file names #if !defined(FEAT_CLIPBOARD) --- 47,54 ---- #define FEAT_SHORTCUT // resolve shortcuts ! // Access Control List (actually security info). ! #define HAVE_ACL #define USE_FNAME_CASE // adjust case of file names #if !defined(FEAT_CLIPBOARD) *************** *** 134,150 **** # define IO_REPARSE_TAG_SYMLINK 0xA000000C #endif ! #if defined(_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 // for _resetstkoflw() - # if defined(_MSC_VER) && (_MSC_VER >= 1300) - # define RESETSTKOFLW _resetstkoflw - # else - # define RESETSTKOFLW myresetstkoflw - # define MYRESETSTKOFLW - # endif #endif /* --- 129,139 ---- # define IO_REPARSE_TAG_SYMLINK 0xA000000C #endif ! #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 // for _resetstkoflw() #endif /* *************** *** 154,167 **** #ifdef _DEBUG ! # if defined(_MSC_VER) && (_MSC_VER >= 1000) ! // Use the new debugging tools in Visual C++ 4.x ! # include ! # define ASSERT(f) _ASSERT(f) ! # else ! # include ! # define ASSERT(f) assert(f) ! # endif # define TRACE Trace # define TRACE0(sz) Trace(_T("%s"), _T(sz)) --- 143,150 ---- #ifdef _DEBUG ! # include ! # define ASSERT(f) _ASSERT(f) # define TRACE Trace # define TRACE0(sz) Trace(_T("%s"), _T(sz)) *** ../vim-8.2.4198/src/proto/os_win32.pro 2021-07-24 12:57:25.481296527 +0100 --- src/proto/os_win32.pro 2022-01-24 11:12:27.449341813 +0000 *************** *** 64,70 **** 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); --- 64,69 ---- *** ../vim-8.2.4198/src/time.c 2022-01-20 14:25:50.291988095 +0000 --- src/time.c 2022-01-24 11:12:27.449341813 +0000 *************** *** 1022,1035 **** 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. --- 1022,1027 ---- *************** *** 1068,1089 **** buf[bi++] = 0; else { ! #if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4 c = (int)(wtime >> (i * 8)); ! #else c = (int)((long_u)wtime >> (i * 8)); ! #endif buf[bi++] = c; } } } - #ifdef _MSC_VER - # if (_MSC_VER <= 1200) - # pragma optimize("", on) - # endif - #endif - #endif /* --- 1060,1075 ---- buf[bi++] = 0; else { ! # if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4 c = (int)(wtime >> (i * 8)); ! # else c = (int)((long_u)wtime >> (i * 8)); ! # endif buf[bi++] = c; } } } #endif /* *** ../vim-8.2.4198/src/vim.h 2022-01-20 12:44:23.523631726 +0000 --- src/vim.h 2022-01-24 11:12:27.449341813 +0000 *************** *** 356,362 **** // 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) # define __w64 # endif typedef unsigned long __w64 long_u; --- 356,362 ---- // 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. ! # ifndef _MSC_VER # define __w64 # endif typedef unsigned long __w64 long_u; *************** *** 383,389 **** * 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__) typedef __int64 off_T; # ifdef __MINGW32__ # define vim_lseek lseek64 --- 383,389 ---- * We assume that when fseeko() is available then ftello() is too. * Note that Windows has different function names. */ ! #ifdef MSWIN typedef __int64 off_T; # ifdef __MINGW32__ # define vim_lseek lseek64 *************** *** 2162,2170 **** 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 typedef struct _stat64 stat_T; #else typedef struct stat stat_T; --- 2162,2169 ---- typedef int Clipboard_T; // This is required for the prototypes. #endif ! // Use 64-bit stat structure on MS-Windows. ! #ifdef MSWIN typedef struct _stat64 stat_T; #else typedef struct stat stat_T; *** ../vim-8.2.4198/src/version.c 2022-01-23 20:00:38.724909590 +0000 --- src/version.c 2022-01-24 11:23:30.752440543 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4199, /**/ -- BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow? ARTHUR: What do you mean? An African or European swallow? BRIDGEKEEPER: Er ... I don't know that ... Aaaaarrrrrrggghhh! BRIDGEKEEPER is cast into the gorge. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///