From f5acd8d1359f505aad80d1e4ce9462723698b7ad Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 20 Oct 2011 15:48:07 -0700 Subject: [PATCH] Remove some scan-build warnings. One of these is a real bug, the others are just minor optimizations. --- tgt-stub/stub.c | 5 +++-- vpi/sys_random.c | 1 + vpi/vams_simparam.c | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 76002195d..24fd5bdb4 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -229,7 +229,7 @@ static void show_lpm_arithmetic_pins(ivl_lpm_t net) { ivl_nexus_t nex; nex = ivl_lpm_q(net); - fprintf(out, " Q: %p\n", ivl_lpm_q(net)); + fprintf(out, " Q: %p\n", nex); nex = ivl_lpm_data(net, 0); fprintf(out, " DataA: %p\n", nex); @@ -247,7 +247,7 @@ static void show_lpm_abs(ivl_lpm_t net) ivl_lpm_basename(net), width); nex = ivl_lpm_q(net); - fprintf(out, " Q: %p\n", ivl_lpm_q(net)); + fprintf(out, " Q: %p\n", nex); nex = ivl_lpm_data(net, 0); fprintf(out, " D: %p\n", nex); @@ -690,6 +690,7 @@ static void show_lpm_re(ivl_lpm_t net) break; case IVL_LPM_RE_NOR: type = "NOR"; + break; case IVL_LPM_RE_XOR: type = "XOR"; break; diff --git a/vpi/sys_random.c b/vpi/sys_random.c index 2193b3140..3300f5fbb 100644 --- a/vpi/sys_random.c +++ b/vpi/sys_random.c @@ -567,6 +567,7 @@ static PLI_INT32 sys_urandom_range_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) /* Check that there are at least two arguments. */ arg = vpi_scan(argv); /* This should never be zero. */ + assert(arg); arg = vpi_scan(argv); if (arg == 0) { vpi_printf("ERROR: %s requires two arguments.\n", name); diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index 2246ac5c9..74fa6772d 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -214,8 +214,7 @@ static PLI_INT32 simparam_str_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) char path [MAX_STRING_RESULT]; char *ptr = getcwd(path, MAX_STRING_RESULT); if (ptr == NULL) { - ptr = strcpy(path, ""); + strcpy(path, ""); } retval = strdup(path); } else if (strcmp(param, "module") == 0) {