From 663ab34ae72d7f762baa9be0a5916871d0a21a76 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 14 Dec 2009 18:43:00 -0800 Subject: [PATCH] V0.9 Add casts/etc. in vvp directory to remove Cygwin compile warnings. --- vvp/compile.cc | 2 ++ vvp/vpi_callback.cc | 18 ++++++++++-------- vvp/vpi_const.cc | 7 ++++--- vvp/vpi_mcd.cc | 2 +- vvp/vpi_priv.cc | 24 ++++++++++++------------ vvp/vpi_signal.cc | 13 +++++++------ vvp/vpi_tasks.cc | 21 +++++++++++++-------- vvp/vpi_time.cc | 2 +- vvp/vpi_vthr_vector.cc | 8 ++++---- vvp/vpip_format.c | 4 ++-- vvp/vvp_net.cc | 12 ++++++------ 11 files changed, 62 insertions(+), 51 deletions(-) diff --git a/vvp/compile.cc b/vvp/compile.cc index 2f718395a..cf22ade3c 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -1370,6 +1370,8 @@ static struct __vpiModPathSrc*make_modpath_src(struct __vpiModPath*path, break; #endif default: + posedge = false; + negedge = false; fprintf(stderr, "Unknown edge identifier %c(%d).\n", edge, edge); assert(0); diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index f5c702330..461561d48 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -259,7 +259,8 @@ static struct __vpiCallback* make_sync(p_cb_data data, bool readonly_flag) } default: - fprintf(stderr, "Unsupported time type %d.\n", obj->cb_time.type); + fprintf(stderr, "Unsupported time type %d.\n", + (int)obj->cb_time.type); assert(0); break; } @@ -288,7 +289,8 @@ static struct __vpiCallback* make_afterdelay(p_cb_data data, bool simtime_flag) break; default: - fprintf(stderr, "Unsupported time type %d.\n", obj->cb_time.type); + fprintf(stderr, "Unsupported time type %d.\n", + (int)obj->cb_time.type); assert(0); tv = 0; break; @@ -465,7 +467,7 @@ vpiHandle vpi_register_cb(p_cb_data data) default: fprintf(stderr, "vpi error: vpi_register_cb invalid or " "unsupported callback reason: %d\n", - data->reason); + (int)data->reason); break; } @@ -510,7 +512,7 @@ void callback_execute(struct __vpiCallback*cur) break; default: fprintf(stderr, "Unsupported time format %d.\n", - cur->cb_data.time->type); + (int)cur->cb_data.time->type); assert(0); break; } @@ -641,7 +643,7 @@ void vvp_fun_signal4::get_value(struct t_vpi_value*vp) default: fprintf(stderr, "vpi_callback: value " "format %d not supported (fun_signal)\n", - vp->format); + (int)vp->format); } } @@ -656,7 +658,7 @@ void vvp_fun_signal8::get_value(struct t_vpi_value*vp) default: fprintf(stderr, "vpi_callback: value " "format %d not supported (fun_signal8)\n", - vp->format); + (int)vp->format); } } @@ -716,6 +718,6 @@ void vvp_fun_signal_real::get_value(struct t_vpi_value*vp) default: fprintf(stderr, "vpi_callback: value " "format %d not supported (fun_signal_real)\n", - vp->format); + (int)vp->format); } } diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index 78202e521..ee0b929bc 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -167,7 +167,8 @@ static void string_value(vpiHandle ref, p_vpi_value vp) default: - fprintf(stderr, "ERROR (vpi_const.cc): vp->format: %d\n", vp->format); + fprintf(stderr, "ERROR (vpi_const.cc): vp->format: %d\n", + (int)vp->format); assert(0); vp->format = vpiSuppressVal; @@ -405,7 +406,7 @@ static void binary_value(vpiHandle ref, p_vpi_value vp) default: fprintf(stderr, "vvp error: format %d not supported " - "by vpiBinaryConst\n", vp->format); + "by vpiBinaryConst\n", (int)vp->format); vp->format = vpiSuppressVal; break; } @@ -624,7 +625,7 @@ static void dec_value(vpiHandle ref, p_vpi_value vp) default: fprintf(stderr, "vvp error (vpi_const.cc): format %d not supported " - "by vpiDecConst\n", vp->format); + "by vpiDecConst\n", (int)vp->format); vp->format = vpiSuppressVal; break; } diff --git a/vvp/vpi_mcd.cc b/vvp/vpi_mcd.cc index a10fc539f..ce6867e65 100644 --- a/vvp/vpi_mcd.cc +++ b/vvp/vpi_mcd.cc @@ -183,7 +183,7 @@ vpi_mcd_vprintf(PLI_UINT32 mcd, const char*fmt, va_list ap) if (vpi_trace) { fprintf(vpi_trace, "vpi_mcd_vprintf(0x%08x, %s, ...);\n", - mcd, fmt); + (unsigned int)mcd, fmt); } #ifdef __MINGW32__ diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 862828c0a..3d83f7b5e 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -206,7 +206,7 @@ static const char* vpi_property_str(PLI_INT32 code) case vpiSize: return "vpiSize"; default: - sprintf(buf, "%d", code); + sprintf(buf, "%d", (int)code); } return buf; } @@ -256,7 +256,7 @@ static const char* vpi_type_values(PLI_INT32 code) case vpiTimeVar: return "vpiTimeVar"; default: - sprintf(buf, "%d", code); + sprintf(buf, "%d", (int)code); } return buf; } @@ -429,7 +429,7 @@ void vpi_get_time(vpiHandle obj, s_vpi_time*vp) break; default: - fprintf(stderr, "vpi_get_time: unknown type: %d\n", vp->type); + fprintf(stderr, "vpi_get_time: unknown type: %d\n", (int)vp->type); assert(0); break; } @@ -521,7 +521,7 @@ void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width, switch (vp->format) { default: fprintf(stderr, "sorry: Format %d not implemented for " - "getting vector values.\n", vp->format); + "getting vector values.\n", (int)vp->format); assert(0); case vpiSuppressVal: @@ -688,7 +688,7 @@ void vpip_real_get_value(double real, s_vpi_value*vp) switch (vp->format) { default: fprintf(stderr, "sorry: Format %d not implemented for " - "getting real values.\n", vp->format); + "getting real values.\n", (int)vp->format); assert(0); case vpiSuppressVal: @@ -723,7 +723,7 @@ double real_from_vpi_value(s_vpi_value*vp) switch (vp->format) { default: fprintf(stderr, "sorry: Format %d not implemented for " - "putting real values.\n", vp->format); + "putting real values.\n", (int)vp->format); assert(0); case vpiRealVal: @@ -783,12 +783,12 @@ void vpi_get_value(vpiHandle expr, s_vpi_value*vp) case vpiIntVal: fprintf(vpi_trace, "vpi_get_value(<%d>...) -> int=%d\n", - expr->vpi_type->type_code, vp->value.integer); + expr->vpi_type->type_code, (int)vp->value.integer); break; default: fprintf(vpi_trace, "vpi_get_value(<%d>...) -> <%d>=?\n", - expr->vpi_type->type_code, vp->format); + expr->vpi_type->type_code, (int)vp->format); } return; } @@ -913,7 +913,7 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref) if (ref == 0) { fprintf(stderr, "internal error: vpi_handle(type=%d, ref=0)\n", - type); + (int)type); } assert(ref); @@ -921,7 +921,7 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref) if (vpi_trace) { fprintf(vpi_trace, "vpi_handle(%d, %p) -X\n", - type, ref); + (int)type, ref); } return 0; @@ -932,7 +932,7 @@ vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref) if (vpi_trace) { fprintf(vpi_trace, "vpi_handle(%d, %p) -> %p\n", - type, ref, res); + (int)type, ref, res); } return res; @@ -972,7 +972,7 @@ vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle ref) if (vpi_trace) { fprintf(vpi_trace, "vpi_iterate(%d, %p) ->%s\n", - type, ref, rtn ? "" : " (null)"); + (int)type, ref, rtn ? "" : " (null)"); } return rtn; diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index f3b2343e9..3a01b42b5 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -718,7 +718,8 @@ static void signal_get_value(vpiHandle ref, s_vpi_value*vp) fprintf(stderr, "vvp internal error: get_value: " "value type %u not implemented." " Signal is %s in scope %s\n", - vp->format, vpi_get_str(vpiName, ref), vpip_scope(rfp)->name); + (int)vp->format, vpi_get_str(vpiName, ref), + vpip_scope(rfp)->name); assert(0); } } @@ -850,7 +851,7 @@ vvp_vector4_t vec4_from_vpi_value(s_vpi_value*vp, unsigned wid) default: fprintf(stderr, "vvp internal error: put_value: " "value type %u not implemented here.\n", - vp->format); + (int)vp->format); assert(0); } @@ -1105,8 +1106,8 @@ static char* PV_get_str(int code, vpiHandle ref) case vpiFullName: { const char*nm = vpi_get_str(code, rfp->parent); char full[1024+strlen(nm)]; - sprintf(full, "%s[%d:%d]", nm, vpi_get(vpiLeftRange, ref), - vpi_get(vpiRightRange, ref)); + sprintf(full, "%s[%d:%d]", nm, (int)vpi_get(vpiLeftRange, ref), + (int)vpi_get(vpiRightRange, ref)); return simple_set_rbuf_str(full); } @@ -1169,8 +1170,8 @@ static void PV_get_value(vpiHandle ref, p_vpi_value vp) default: fprintf(stderr, "vvp internal error: PV_get_value: " - "value type %u not implemented. Signal is %s.\n", - vp->format, vpi_get_str(vpiFullName, rfp->parent)); + "value type %d not implemented. Signal is %s.\n", + (int)vp->format, vpi_get_str(vpiFullName, rfp->parent)); assert(0); } } diff --git a/vvp/vpi_tasks.cc b/vvp/vpi_tasks.cc index 245c95575..d40fc42cf 100644 --- a/vvp/vpi_tasks.cc +++ b/vvp/vpi_tasks.cc @@ -223,7 +223,8 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp, int) vthread_put_bit(vpip_current_vthread, rfp->vbit, BIT4_Z); break; default: - fprintf(stderr, "Unsupported value %d.\n", vp->value.scalar); + fprintf(stderr, "Unsupported value %d.\n", + (int)vp->value.scalar); assert(0); } break; @@ -278,6 +279,7 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp, int) bit4 = BIT4_X; break; default: + bit4 = BIT4_X; fprintf(stderr, "Unsupported bit value %d.\n", bit); assert(0); @@ -292,7 +294,7 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp, int) break; default: - fprintf(stderr, "Unsupported format %d.\n", vp->format); + fprintf(stderr, "Unsupported format %d.\n", (int)vp->format); assert(0); } @@ -319,7 +321,7 @@ static vpiHandle sysfunc_put_real_value(vpiHandle ref, p_vpi_value vp, int) break; default: - fprintf(stderr, "Unsupported format %d.\n", vp->format); + fprintf(stderr, "Unsupported format %d.\n", (int)vp->format); assert(0); } @@ -356,7 +358,7 @@ static vpiHandle sysfunc_put_4net_value(vpiHandle ref, p_vpi_value vp, int) break; default: fprintf(stderr, "Unsupported bit value %d.\n", - vp->value.scalar); + (int)vp->value.scalar); assert(0); } } @@ -409,6 +411,7 @@ static vpiHandle sysfunc_put_4net_value(vpiHandle ref, p_vpi_value vp, int) bit4 = BIT4_X; break; default: + bit4 = BIT4_X; fprintf(stderr, "Unsupported bit value %d.\n", bit); assert(0); @@ -422,7 +425,8 @@ static vpiHandle sysfunc_put_4net_value(vpiHandle ref, p_vpi_value vp, int) break; default: - fprintf(stderr, "XXXX format=%d, vwid=%u\n", vp->format, rfp->vwid); + fprintf(stderr, "XXXX format=%d, vwid=%u\n", (int)vp->format, + rfp->vwid); assert(0); } @@ -446,7 +450,8 @@ static vpiHandle sysfunc_put_rnet_value(vpiHandle ref, p_vpi_value vp, int) break; default: - fprintf(stderr, "Unsupported format %d.\n", vp->format); + val = 0.0; + fprintf(stderr, "Unsupported format %d.\n", (int)vp->format); assert(0); } @@ -588,7 +593,7 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, int vwid, break; default: - fprintf(stderr, "Unsupported type %d.\n", defn->info.type); + fprintf(stderr, "Unsupported type %d.\n", (int)defn->info.type); assert(0); } @@ -730,7 +735,7 @@ void vpi_register_systf(const struct t_vpi_systf_data*ss) cur->base.vpi_type = &vpip_sysfunc_def_rt; break; default: - fprintf(stderr, "Unsupported type %d.\n", ss->type); + fprintf(stderr, "Unsupported type %d.\n", (int)ss->type); assert(0); } diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index d434b7ac8..94492728d 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -280,7 +280,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func, break; default: - fprintf(stderr, "vpi_time: unknown format: %d\n", vp->format); + fprintf(stderr, "vpi_time: unknown format: %d\n", (int)vp->format); assert(0); } } diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 6852f55a7..edef159dc 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -351,7 +351,7 @@ static void vthr_vec_get_value(vpiHandle ref, s_vpi_value*vp) default: fprintf(stderr, "internal error: vpi_get_value()" - " not implemented for vthr_vectors.\n", vp->format); + " not implemented for vthr_vectors.\n", (int)vp->format); /* XXXX Not implemented yet. */ assert(0); } @@ -398,7 +398,7 @@ static vpiHandle vthr_vec_put_value(vpiHandle ref, s_vpi_value*vp, int) break; default: fprintf(stderr, "Unsupported scalar value %d.\n", - vp->value.scalar); + (int)vp->value.scalar); assert(0); } break; @@ -431,7 +431,7 @@ static vpiHandle vthr_vec_put_value(vpiHandle ref, s_vpi_value*vp, int) } default: - fprintf(stderr, "Unsupported format %d.\n", vp->format); + fprintf(stderr, "Unsupported format %d.\n", (int)vp->format); assert(0); } @@ -579,7 +579,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp) default: fprintf(stderr, "vvp error: get %d not supported " - "by vpiConstant (Real)\n", vp->format); + "by vpiConstant (Real)\n", (int)vp->format); vp->format = vpiSuppressVal; break; diff --git a/vvp/vpip_format.c b/vvp/vpip_format.c index e6f227793..6c3ae370d 100644 --- a/vvp/vpip_format.c +++ b/vvp/vpip_format.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2008 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -100,7 +100,7 @@ void vpip_format_strength(char*str, s_vpi_value*value, unsigned bit) break; default: fprintf(stderr, "Unsupported type %d.\n", - value->value.strength[bit].logic); + (int)value->value.strength[bit].logic); assert(0); } } diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 9cfe550ca..7dad4df0d 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -190,10 +190,10 @@ vvp_bit4_t add_with_carry(vvp_bit4_t a, vvp_bit4_t b, vvp_bit4_t&c) case 3: c = BIT4_1; return BIT4_1; - default: - fprintf(stderr, "Incorrect result %d.\n", sum); - assert(0); } + fprintf(stderr, "Incorrect result %d.\n", sum); + assert(0); + return BIT4_X; } vvp_bit4_t scalar_to_bit4(PLI_INT32 scalar) @@ -207,10 +207,10 @@ vvp_bit4_t scalar_to_bit4(PLI_INT32 scalar) return BIT4_X; case vpiZ: return BIT4_Z; - default: - fprintf(stderr, "Unsupported scalar value %d.\n", scalar); - assert(0); } + fprintf(stderr, "Unsupported scalar value %d.\n", (int)scalar); + assert(0); + return BIT4_X; } vvp_bit4_t operator ^ (vvp_bit4_t a, vvp_bit4_t b)