From 6d5d06cae4199c302aef33a337e70603ba1c561a Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 9 Sep 2009 17:27:45 -0700 Subject: [PATCH] Squash some gcc 4.3.3 warnings. This patch clears all the gcc 4.3.3 warning that can be fixed. The remaining warning is dictated by older versions of the 1364 standard. --- libveriuser/getp.c | 2 ++ tgt-vvp/draw_vpi.c | 2 +- vpi/sys_fileio.c | 6 ++---- vvp/vvp_net.cc | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libveriuser/getp.c b/libveriuser/getp.c index 5e074bdd8..9d832e4a4 100644 --- a/libveriuser/getp.c +++ b/libveriuser/getp.c @@ -53,6 +53,8 @@ PLI_INT32 tf_igetp(PLI_INT32 n, void *obj) { value.format = vpiStringVal; vpi_get_value(arg_h, &value); + /* The following may generate a compilation warning, but this + * functionality is required by some versions of the standard. */ rtn = (int) value.value.str; /* Oh my */ } else { value.format = vpiIntVal; diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 0858e672c..2695f56db 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -217,7 +217,7 @@ 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 " - "signed index less than %d bits.\n", + "signed index less than %zu bits.\n", ivl_expr_file(expr), ivl_expr_lineno(expr), 8*sizeof(int)); diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 2fccdd49e..9961d95b6 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -214,7 +214,6 @@ static PLI_INT32 sys_fclose_calltf(PLI_BYTE8*name) vpiHandle fd = vpi_scan(argv); s_vpi_value val; PLI_UINT32 fd_mcd; - char *str = ""; /* This prevents the compiler from complaining. */ errno = 0; vpi_free_object(argv); @@ -225,7 +224,7 @@ static PLI_INT32 sys_fclose_calltf(PLI_BYTE8*name) fd_mcd = val.value.integer; if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || - ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, str) == EOF) || + ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, "%s", "") == EOF) || (! fd_mcd)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); @@ -254,7 +253,6 @@ static PLI_INT32 sys_fflush_calltf(PLI_BYTE8*name) s_vpi_value val; PLI_UINT32 fd_mcd; FILE *fp; - char *str = ""; /* This prevents the compiler from complaining. */ errno = 0; /* If we have no argument then flush all the streams. */ @@ -274,7 +272,7 @@ static PLI_INT32 sys_fflush_calltf(PLI_BYTE8*name) if (fd_mcd == 0) return 0; if ((! IS_MCD(fd_mcd) && vpi_get_file(fd_mcd) == NULL) || - ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, str) == EOF) || + ( IS_MCD(fd_mcd) && vpi_mcd_printf(fd_mcd, "%s", "") == EOF) || (! fd_mcd)) { vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 825b8ed1f..cdf3cfe67 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -1143,8 +1143,8 @@ vvp_vector4_t& vvp_vector4_t::operator |= (const vvp_vector4_t&that) if (size_ <= BITS_PER_WORD) { unsigned long tmp = abits_val_ | bbits_val_ | that.abits_val_ | that.bbits_val_; - bbits_val_ = (~abits_val_ | bbits_val_) & that.bbits_val_ | - (~that.abits_val_ | that.bbits_val_) & bbits_val_; + bbits_val_ = ((~abits_val_ | bbits_val_) & that.bbits_val_) | + ((~that.abits_val_ | that.bbits_val_) & bbits_val_); abits_val_ = tmp; } else { @@ -1152,10 +1152,10 @@ vvp_vector4_t& vvp_vector4_t::operator |= (const vvp_vector4_t&that) for (unsigned idx = 0; idx < words ; idx += 1) { unsigned long tmp = abits_ptr_[idx] | bbits_ptr_[idx] | that.abits_ptr_[idx] | that.bbits_ptr_[idx]; - bbits_ptr_[idx] = (~abits_ptr_[idx] | bbits_ptr_[idx]) & - that.bbits_ptr_[idx] | - (~that.abits_ptr_[idx] | - that.bbits_ptr_[idx]) & bbits_ptr_[idx]; + bbits_ptr_[idx] = ((~abits_ptr_[idx] | bbits_ptr_[idx]) & + that.bbits_ptr_[idx]) | + ((~that.abits_ptr_[idx] | + that.bbits_ptr_[idx]) & bbits_ptr_[idx]); abits_ptr_[idx] = tmp; } }