Fix some MinGW compile warnings.

This patch fixes some compile warnings found using the latest
MinGW compiler.
This commit is contained in:
Cary R 2010-01-27 08:52:20 -08:00 committed by Stephen Williams
parent 65744da19c
commit 971576589e
4 changed files with 30 additions and 2 deletions

View File

@ -236,7 +236,9 @@ static int GetRegistryKey(char *key, char **value)
}
regKeyBuffer[regKeySize] = 0; /* makes sure there is a trailing NULL */
lrv = RegQueryValueEx(hkKey,key,NULL,&regKeyType,regKeyBuffer,&regKeySize);
/* This needs an unsigned char *, but for MinGW the char is signed. */
lrv = RegQueryValueEx(hkKey, key, NULL, &regKeyType,
(unsigned char *) regKeyBuffer, &regKeySize);
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
lrv = RegCloseKey(hkKey);
free(regKeyBuffer);
@ -269,7 +271,9 @@ static void SetRegistryKey(char *key, char *value)
&res) != ERROR_SUCCESS)
return;
RegSetValueEx(hkKey,key,0,REG_SZ,value,strlen(value)+1);
/* This needs an unsigned char *, but for MinGW the char is signed. */
RegSetValueEx(hkKey, key, 0, REG_SZ, (unsigned char *) value,
strlen(value)+1);
RegCloseKey(hkKey);
printf("info: storing %s in Windows' registry entry\n",value);

View File

@ -161,7 +161,11 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 "
"may give incorrect results for "
"an array select with a signed "
#ifdef __MINGW32__ /* MinGW does not know about z. */
"index less than %u bits.\n",
#else
"index less than %zu bits.\n",
#endif
ivl_expr_file(expr),
ivl_expr_lineno(expr),
8*sizeof(int));
@ -230,7 +234,11 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
(ivl_expr_width(bexpr) < 8*sizeof(int))) {
fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give "
"incorrect results for a select with a "
#ifdef __MINGW32__ /* MinGW does not know about z. */
"signed index less than %u bits.\n",
#else
"signed index less than %zu bits.\n",
#endif
ivl_expr_file(expr),
ivl_expr_lineno(expr),
8*sizeof(int));

View File

@ -1692,7 +1692,11 @@ static void draw_lpm_part(ivl_lpm_t net)
if (ivl_lpm_signed(net) && width_of_nexus(sel) < 8*sizeof(int)) {
fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 may give "
"incorrect results for a select with a "
#ifdef __MINGW32__ /* MinGW does not know about z. */
"signed index less than %u bits.\n",
#else
"signed index less than %zu bits.\n",
#endif
ivl_lpm_file(net), ivl_lpm_lineno(net),
8*sizeof(int));
}

View File

@ -366,16 +366,28 @@ int main(int argc, char*argv[])
}
if (verbose_flag) {
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu functors (net_fun pool=%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu functors (net_fun pool=%zu bytes)\n",
#endif
count_functors, size_vvp_net_funs);
vpi_mcd_printf(1, " %8lu logic\n", count_functors_logic);
vpi_mcd_printf(1, " %8lu bufif\n", count_functors_bufif);
vpi_mcd_printf(1, " %8lu resolv\n",count_functors_resolv);
vpi_mcd_printf(1, " %8lu signals\n", count_functors_sig);
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu opcodes (%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu opcodes (%zu bytes)\n",
#endif
count_opcodes, size_opcodes);
vpi_mcd_printf(1, " ... %8lu nets\n", count_vpi_nets);
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu vvp_nets (%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu vvp_nets (%zu bytes)\n",
#endif
count_vvp_nets, size_vvp_nets);
vpi_mcd_printf(1, " ... %8lu arrays (%lu words)\n",
count_net_arrays, count_net_array_words);