diff --git a/tgt-stub/constant.c b/tgt-stub/constant.c index 885862e3b..4d99dc924 100644 --- a/tgt-stub/constant.c +++ b/tgt-stub/constant.c @@ -42,7 +42,6 @@ void show_constant(ivl_net_const_t net) case IVL_VT_REAL: fprintf(out, "%f", ivl_const_real(net)); break; - break; default: fprintf(out, ""); break; diff --git a/tgt-stub/cppcheck.sup b/tgt-stub/cppcheck.sup index e72becfc0..a4a512adb 100644 --- a/tgt-stub/cppcheck.sup +++ b/tgt-stub/cppcheck.sup @@ -2,7 +2,7 @@ // are not used here. // target_design() -unusedFunction:stub.c:1773 +unusedFunction:stub.c:1774 // target_query() -unusedFunction:stub.c:1843 +unusedFunction:stub.c:1844 diff --git a/tgt-vlog95/logic_lpm.c b/tgt-vlog95/logic_lpm.c index 5a7bfcdd6..07f46780e 100644 --- a/tgt-vlog95/logic_lpm.c +++ b/tgt-vlog95/logic_lpm.c @@ -1407,7 +1407,7 @@ static void emit_lpm_ff(ivl_scope_t scope, ivl_lpm_t lpm) } nex = ivl_lpm_sync_set(lpm); if (nex) { - if (! sset_bits || (sset_bits && (sset_bits[0] == '1'))) { + if (! sset_bits || (sset_bits[0] == '1')) { emit_nexus_as_ca(scope, nex, 0, 0); if (have_data) fprintf(vlog_out, " | "); } else { diff --git a/tgt-vvp/eval_vec4.c b/tgt-vvp/eval_vec4.c index 1763c71e5..322b73573 100644 --- a/tgt-vvp/eval_vec4.c +++ b/tgt-vvp/eval_vec4.c @@ -1032,7 +1032,7 @@ static void draw_string_vec4(ivl_expr_t expr) for (unsigned idx = 0 ; idx < wid ; idx += 8) { tmp <<= 8; - tmp |= *p; + tmp |= (unsigned long)*p; p += 1; tmp_wid += 8; if (tmp_wid == 32) { diff --git a/vpi/sys_display.c b/vpi/sys_display.c index c6b04df67..a7a34dfa7 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -74,7 +74,7 @@ static void my_mcd_rawwrite(PLI_UINT32 mcd, const char*buf, size_t count) if (fp) { while (count > 0) { size_t rc = fwrite(buf, 1, count, fp); - if (rc <= 0) break; + if (rc == 0) break; count -= rc; buf += rc; } diff --git a/vvp/draw_tt.c b/vvp/draw_tt.c index 10a5da89d..f881fcf7c 100644 --- a/vvp/draw_tt.c +++ b/vvp/draw_tt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2015 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 @@ -63,7 +63,7 @@ static void draw_hex_table(void) printf(" 'X',"); else - printf(" '%c',", "0123456789abcdef"[bv]); + printf(" '%c',", (unsigned)"0123456789abcdef"[bv]); if (((idx+1) % 8) == 0) printf("\n"); @@ -109,7 +109,7 @@ static void draw_oct_table(void) printf(" 'X',"); else - printf(" '%c',", "01234567"[bv]); + printf(" '%c',", (unsigned)"01234567"[bv]); if (((idx+1) % 8) == 0) printf("\n"); diff --git a/vvp/main.cc b/vvp/main.cc index 5e24f467e..19c9707e1 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -148,13 +148,13 @@ void verify_version(char*ivl_ver, char*commit) // This also catches a potential new-new format that has // another sub-minor number. file_extra[0] = 0; - int rc = sscanf(ivl_ver, "%d.%d.%d %128s", &file_major, &file_minor, &file_minor2, file_extra); + int rc = sscanf(ivl_ver, "%d.%d.%d %127s", &file_major, &file_minor, &file_minor2, file_extra); // If it wasn't the old style format, try the new format: // . if (rc == 2) { file_extra[0] = 0; - rc = sscanf(ivl_ver, "%d.%d %128s", &file_major, &file_minor, file_extra); + rc = sscanf(ivl_ver, "%d.%d %127s", &file_major, &file_minor, file_extra); file_minor2 = 0; } diff --git a/vvp/vpi_darray.cc b/vvp/vpi_darray.cc index a747df2bf..4e266cb89 100644 --- a/vvp/vpi_darray.cc +++ b/vvp/vpi_darray.cc @@ -170,7 +170,6 @@ void __vpiDarrayVar::put_word_value(struct __vpiArrayWord*word, p_vpi_value vp, case vpiVectorVal: // 2 vs 4 state logic? { - int new_bit; int size = get_word_size(); PLI_INT32 a = 0, b = 0; vvp_vector4_t new_vec(size); @@ -178,6 +177,7 @@ void __vpiDarrayVar::put_word_value(struct __vpiArrayWord*word, p_vpi_value vp, vec--; // it will be increased in the first loop iteration for(int i = 0; i < size; ++i) { + int new_bit; if(i % (8 * sizeof(vec->aval)) == 0) { ++vec; a = vec->aval; diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index c4593be6d..858286b9e 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -161,7 +161,7 @@ static unsigned hash_string(const char*text) unsigned h = 0; while (*text) { - h = (h << 4) ^ (h >> 28) ^ *text; + h = (h << 4) ^ (h >> 28) ^ (unsigned)*text; text += 1; } return h; diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 1374fb6fa..608e41cee 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -851,7 +851,7 @@ vvp_vector4_t vec4_from_vpi_value(s_vpi_value*vp, unsigned wid) case vpiIntVal: { long vpi_val = vp->value.integer; for (unsigned idx = 0 ; idx < wid ; idx += 1) { - vvp_bit4_t bit = vpi_val&1 ? BIT4_1 : BIT4_0; + vvp_bit4_t bit = (vpi_val & 1) ? BIT4_1 : BIT4_0; val.set_bit(idx, bit); vpi_val >>= 1; } diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index ab7c66fac..215838773 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -153,7 +153,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func, rbuf[num_bits] = 0; for (unsigned i = 1; i <= num_bits; i++) { - rbuf[num_bits-i] = x & 1 ? '1' : '0'; + rbuf[num_bits-i] = (x & 1) ? '1' : '0'; x = x >> 1; } diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 1cdca15aa..bf8edffff 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -3585,10 +3585,10 @@ vvp_scalar_t fully_featured_resolv_(vvp_scalar_t a, vvp_scalar_t b) has an even wider ambiguity. */ unsigned tmp = 0; - int sv1a = a.value_&0x80 ? STREN1(a.value_) : - STREN1(a.value_); - int sv0a = a.value_&0x08 ? STREN0(a.value_) : - STREN0(a.value_); - int sv1b = b.value_&0x80 ? STREN1(b.value_) : - STREN1(b.value_); - int sv0b = b.value_&0x08 ? STREN0(b.value_) : - STREN0(b.value_); + int sv1a = (a.value_ & 0x80) ? STREN1(a.value_) : - STREN1(a.value_); + int sv0a = (a.value_ & 0x08) ? STREN0(a.value_) : - STREN0(a.value_); + int sv1b = (b.value_ & 0x80) ? STREN1(b.value_) : - STREN1(b.value_); + int sv0b = (b.value_ & 0x08) ? STREN0(b.value_) : - STREN0(b.value_); int sv1 = sv1a; int sv0 = sv0a;