From 59b2d23c64a1f96f6f4452f7e549dc3df7ceaf3a Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Wed, 19 Dec 2007 09:29:47 -0800 Subject: [PATCH] chip away at compile-time warnings 1 x format string (real bug) 2 x uninitialized variable (potential bugs), 1 x parentheses around assignment used as truth value (shut up compiler) --- vpi/sys_display.c | 5 ++++- vpi/sys_sdf.c | 2 +- vpi/vcd_priv.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 647612486..cc7caa172 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1590,6 +1590,7 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus, case 'u': case 'U': *idx += 1; + size = 0; /* fallback value if errors */ if (ljust != 0 || plus != 0 || ld_zero != 0 || width != -1 || prec != -1) { vpi_printf("WARNING: invalid format %s%s.\n", info->name, fmtb); @@ -1661,6 +1662,7 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus, case 'z': case 'Z': *idx += 1; + size = 0; /* fallback value if errors */ if (ljust != 0 || plus != 0 || ld_zero != 0 || width != -1 || prec != -1) { vpi_printf("WARNING: invalid format %s%s.\n", info->name, fmtb); @@ -2161,6 +2163,7 @@ static PLI_INT32 sys_printtimescale_calltf(PLI_BYTE8*xx) vpiHandle scope; if (!argv) { vpiHandle parent = vpi_handle(vpiScope, sys); + scope = NULL; /* fallback value if parent is NULL */ while (parent) { scope = parent; parent = vpi_handle(vpiScope, scope); @@ -2169,7 +2172,7 @@ static PLI_INT32 sys_printtimescale_calltf(PLI_BYTE8*xx) scope = vpi_scan(argv); vpi_free_object(argv); } - + vpi_printf("Time scale of (%s) is ", vpi_get_str(vpiFullName, scope)); vpi_printf("%s / ", pts_convert(vpi_get(vpiTimeUnit, scope))); vpi_printf("%s\n", pts_convert(vpi_get(vpiTimePrecision, scope))); diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index 253a0cd44..f4d332ae4 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -239,7 +239,7 @@ static PLI_INT32 sys_sdf_annotate_compiletf(PLI_BYTE8*name) return 0; if (vpi_get(vpiType,scope) != vpiModule) { - vpi_printf("SDF ERROR: The second argument of %s", + vpi_printf("SDF ERROR: The second argument of %s" " must be a module instance.\n", name); vpi_control(vpiFinish, 1); } diff --git a/vpi/vcd_priv.c b/vpi/vcd_priv.c index a8462df34..2eef7903f 100644 --- a/vpi/vcd_priv.c +++ b/vpi/vcd_priv.c @@ -382,7 +382,7 @@ PLI_INT32 sys_dumpvars_compiletf(PLI_BYTE8 *name) " numeric.\n", name); /* The rest of the arguments are either a module or a variable. */ - while (arg = vpi_scan(argv)) { + while ((arg=vpi_scan(argv)) != NULL) { switch(vpi_get(vpiType, arg)) { /* The module types. */ case vpiModule: