annotate src/msvc-latest.bat @ 34309:d7cfd8fb1d75 v9.1.0089

patch 9.1.0089: qsort() comparison functions should be transitive Commit: https://github.com/vim/vim/commit/e06e43766500ecb4cd1031fa16cf9cbebdb222c1 Author: Christian Brabandt <cb@256bit.org> Date: Fri Feb 9 19:39:14 2024 +0100 patch 9.1.0089: qsort() comparison functions should be transitive Problem: qsort() comparison functions should be transitive Solution: Do not subtract values, but rather use explicit comparisons Improve qsort() comparison functions There has been a recent report on qsort() causing out-of-bounds read & write in glibc for non transitive comparison functions https://www.qualys.com/2024/01/30/qsort.txt Even so the bug is in glibc's implementation of the qsort() algorithm, it's bad style to just use substraction for the comparison functions, which may cause overflow issues and as hinted at in OpenBSD's manual page for qsort(): "It is almost always an error to use subtraction to compute the return value of the comparison function." So check the qsort() comparison functions and change them to be safe. closes: #13980 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 09 Feb 2024 19:45:06 +0100
parents 54dda39c5bb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30385
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 @echo off
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 rem To be used on MS-Windows for Visual C++ 2017 or later.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 rem See INSTALLpc.txt for information.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 rem
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 rem Usage:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 rem For x86 builds run this with "x86" option:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 rem msvc-latest x86
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 rem For x64 builds run this with "x86_amd64" option or "x64" option:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 rem msvc-latest x86_amd64
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 rem msvc-latest x64
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 rem
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 rem Optional environment variables:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 rem VSWHERE:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 rem Full path to vswhere.exe.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 rem VSVEROPT:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 rem Option to search specific version of Visual Studio.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 rem Default: -latest
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 rem To search VS2017:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 rem set "VSVEROPT=-version [15.0^,16.0^)"
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 rem To search VS2019:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 rem set "VSVEROPT=-version [16.0^,17.0^)"
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 rem To search VS2022:
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 rem set "VSVEROPT=-version [17.0^,18.0^)"
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 if "%VSWHERE%"=="" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 set VSWHERE_SET=yes
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 if not exist "%VSWHERE%" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 echo Error: vswhere not found.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 set VSWHERE=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 set VSWHERE_SET=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 exit /b 1
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 if "%VSVEROPT%"=="" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 set VSVEROPT=-latest
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 set VSVEROPT_SET=yes
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 rem Search Visual Studio Community, Professional or above.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 set InstallDir=%%i
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %*
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 goto done
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 rem Search Visual Studio 2017 Express.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 rem (Visual Studio 2017 Express uses different component IDs.)
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products Microsoft.VisualStudio.Product.WDExpress -property installationPath`) do (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 set InstallDir=%%i
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %*
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 ) else (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 echo Error: vcvarsall.bat not found.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 rem Set ERRORLEVEL to 1.
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 call
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 :done
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 if "%VSWHERE_SET%"=="yes" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 set VSWHERE=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 set VSWHERE_SET=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 if "%VSVEROPT_SET%"=="yes" (
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 set VSVEROPT=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 set VSVEROPT_SET=
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 )
54dda39c5bb3 patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 set InstallDir=