Clean up a few Windows build warnings (not all!)

* build_w32.bat: Quote uses of %VSWHERE% so it can contain spaces
* src/hash.c (hash_init): Avoid use of an undefined struct.
(hash_rehash): Ditto.
* src/vpath.c (construct_vpath_list): Cast explicitly to void*.
This commit is contained in:
Paul Smith 2021-09-05 21:07:14 -04:00
parent f4b8ddf260
commit 0d367bbe6e
3 changed files with 7 additions and 7 deletions

View file

@ -100,7 +100,7 @@ if not ERRORLEVEL 1 goto FoundMSVC
call :FindVswhere
if ERRORLEVEL 1 goto LegacyVS
for /f "tokens=* usebackq" %%i in (`%VSWHERE% -latest -property installationPath`) do (
for /f "tokens=* usebackq" %%i in (`"%VSWHERE%" -latest -property installationPath`) do (
set InstallPath=%%i
)
set "VSVARS=%InstallPath%\VC\Auxiliary\Build\vcvarsall.bat"
@ -404,10 +404,10 @@ goto :EOF
:FindVswhere
set VSWHERE=vswhere
%VSWHERE% -help >nul 2>&1
"%VSWHERE%" -help >nul 2>&1
if not ERRORLEVEL 1 exit /b 0
set "VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere"
%VSWHERE% -help >nul 2>&1
"%VSWHERE%" -help >nul 2>&1
if ERRORLEVEL 1 exit /b 1
goto :EOF

View file

@ -44,11 +44,11 @@ hash_init (struct hash_table *ht, unsigned long size,
{
ht->ht_size = round_up_2 (size);
ht->ht_empty_slots = ht->ht_size;
ht->ht_vec = (void**) CALLOC (struct token *, ht->ht_size);
ht->ht_vec = CALLOC (void *, ht->ht_size);
if (ht->ht_vec == 0)
{
fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"),
ht->ht_size * (unsigned long) sizeof (struct token *));
ht->ht_size * (unsigned long) sizeof (void *));
exit (MAKE_TROUBLE);
}
@ -260,7 +260,7 @@ hash_rehash (struct hash_table *ht)
ht->ht_capacity = ht->ht_size - (ht->ht_size >> 4);
}
ht->ht_rehashes++;
ht->ht_vec = (void **) CALLOC (struct token *, ht->ht_size);
ht->ht_vec = CALLOC (void *, ht->ht_size);
for (ovp = old_vec; ovp < &old_vec[old_ht_size]; ovp++)
{

View file

@ -277,7 +277,7 @@ construct_vpath_list (char *pattern, char *dirpath)
entry, to where the nil-pointer terminator goes.
Usually this is maxelem - 1. If not, shrink down. */
if (elem < (maxelem - 1))
vpath = xrealloc (vpath, (elem+1) * sizeof (const char *));
vpath = xrealloc ((void *)vpath, (elem+1) * sizeof (const char *));
/* Put the nil-pointer terminator on the end of the VPATH list. */
vpath[elem] = NULL;