Fix some cppcheck warnings
This commit is contained in:
parent
8f095f12de
commit
a65c007fdb
|
|
@ -42,7 +42,6 @@ void show_constant(ivl_net_const_t net)
|
||||||
case IVL_VT_REAL:
|
case IVL_VT_REAL:
|
||||||
fprintf(out, "%f", ivl_const_real(net));
|
fprintf(out, "%f", ivl_const_real(net));
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
fprintf(out, "<unsupported type>");
|
fprintf(out, "<unsupported type>");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// are not used here.
|
// are not used here.
|
||||||
|
|
||||||
// target_design()
|
// target_design()
|
||||||
unusedFunction:stub.c:1773
|
unusedFunction:stub.c:1774
|
||||||
|
|
||||||
// target_query()
|
// target_query()
|
||||||
unusedFunction:stub.c:1843
|
unusedFunction:stub.c:1844
|
||||||
|
|
|
||||||
|
|
@ -1407,7 +1407,7 @@ static void emit_lpm_ff(ivl_scope_t scope, ivl_lpm_t lpm)
|
||||||
}
|
}
|
||||||
nex = ivl_lpm_sync_set(lpm);
|
nex = ivl_lpm_sync_set(lpm);
|
||||||
if (nex) {
|
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);
|
emit_nexus_as_ca(scope, nex, 0, 0);
|
||||||
if (have_data) fprintf(vlog_out, " | ");
|
if (have_data) fprintf(vlog_out, " | ");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1032,7 +1032,7 @@ static void draw_string_vec4(ivl_expr_t expr)
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < wid ; idx += 8) {
|
for (unsigned idx = 0 ; idx < wid ; idx += 8) {
|
||||||
tmp <<= 8;
|
tmp <<= 8;
|
||||||
tmp |= *p;
|
tmp |= (unsigned long)*p;
|
||||||
p += 1;
|
p += 1;
|
||||||
tmp_wid += 8;
|
tmp_wid += 8;
|
||||||
if (tmp_wid == 32) {
|
if (tmp_wid == 32) {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static void my_mcd_rawwrite(PLI_UINT32 mcd, const char*buf, size_t count)
|
||||||
if (fp) {
|
if (fp) {
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
size_t rc = fwrite(buf, 1, count, fp);
|
size_t rc = fwrite(buf, 1, count, fp);
|
||||||
if (rc <= 0) break;
|
if (rc == 0) break;
|
||||||
count -= rc;
|
count -= rc;
|
||||||
buf += rc;
|
buf += rc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* 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',");
|
printf(" 'X',");
|
||||||
|
|
||||||
else
|
else
|
||||||
printf(" '%c',", "0123456789abcdef"[bv]);
|
printf(" '%c',", (unsigned)"0123456789abcdef"[bv]);
|
||||||
|
|
||||||
if (((idx+1) % 8) == 0)
|
if (((idx+1) % 8) == 0)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
@ -109,7 +109,7 @@ static void draw_oct_table(void)
|
||||||
printf(" 'X',");
|
printf(" 'X',");
|
||||||
|
|
||||||
else
|
else
|
||||||
printf(" '%c',", "01234567"[bv]);
|
printf(" '%c',", (unsigned)"01234567"[bv]);
|
||||||
|
|
||||||
if (((idx+1) % 8) == 0)
|
if (((idx+1) % 8) == 0)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
|
||||||
|
|
@ -148,13 +148,13 @@ void verify_version(char*ivl_ver, char*commit)
|
||||||
// This also catches a potential new-new format that has
|
// This also catches a potential new-new format that has
|
||||||
// another sub-minor number.
|
// another sub-minor number.
|
||||||
file_extra[0] = 0;
|
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 it wasn't the old style format, try the new format:
|
||||||
// <major>.<minor> <extra>
|
// <major>.<minor> <extra>
|
||||||
if (rc == 2) {
|
if (rc == 2) {
|
||||||
file_extra[0] = 0;
|
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;
|
file_minor2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ void __vpiDarrayVar::put_word_value(struct __vpiArrayWord*word, p_vpi_value vp,
|
||||||
|
|
||||||
case vpiVectorVal: // 2 vs 4 state logic?
|
case vpiVectorVal: // 2 vs 4 state logic?
|
||||||
{
|
{
|
||||||
int new_bit;
|
|
||||||
int size = get_word_size();
|
int size = get_word_size();
|
||||||
PLI_INT32 a = 0, b = 0;
|
PLI_INT32 a = 0, b = 0;
|
||||||
vvp_vector4_t new_vec(size);
|
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
|
vec--; // it will be increased in the first loop iteration
|
||||||
|
|
||||||
for(int i = 0; i < size; ++i) {
|
for(int i = 0; i < size; ++i) {
|
||||||
|
int new_bit;
|
||||||
if(i % (8 * sizeof(vec->aval)) == 0) {
|
if(i % (8 * sizeof(vec->aval)) == 0) {
|
||||||
++vec;
|
++vec;
|
||||||
a = vec->aval;
|
a = vec->aval;
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ static unsigned hash_string(const char*text)
|
||||||
unsigned h = 0;
|
unsigned h = 0;
|
||||||
|
|
||||||
while (*text) {
|
while (*text) {
|
||||||
h = (h << 4) ^ (h >> 28) ^ *text;
|
h = (h << 4) ^ (h >> 28) ^ (unsigned)*text;
|
||||||
text += 1;
|
text += 1;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,7 @@ vvp_vector4_t vec4_from_vpi_value(s_vpi_value*vp, unsigned wid)
|
||||||
case vpiIntVal: {
|
case vpiIntVal: {
|
||||||
long vpi_val = vp->value.integer;
|
long vpi_val = vp->value.integer;
|
||||||
for (unsigned idx = 0 ; idx < wid ; idx += 1) {
|
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);
|
val.set_bit(idx, bit);
|
||||||
vpi_val >>= 1;
|
vpi_val >>= 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func,
|
||||||
|
|
||||||
rbuf[num_bits] = 0;
|
rbuf[num_bits] = 0;
|
||||||
for (unsigned i = 1; i <= num_bits; i++) {
|
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;
|
x = x >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3585,10 +3585,10 @@ vvp_scalar_t fully_featured_resolv_(vvp_scalar_t a, vvp_scalar_t b)
|
||||||
has an even wider ambiguity. */
|
has an even wider ambiguity. */
|
||||||
|
|
||||||
unsigned tmp = 0;
|
unsigned tmp = 0;
|
||||||
int sv1a = a.value_&0x80 ? STREN1(a.value_) : - STREN1(a.value_);
|
int sv1a = (a.value_ & 0x80) ? STREN1(a.value_) : - STREN1(a.value_);
|
||||||
int sv0a = a.value_&0x08 ? STREN0(a.value_) : - STREN0(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 sv1b = (b.value_ & 0x80) ? STREN1(b.value_) : - STREN1(b.value_);
|
||||||
int sv0b = b.value_&0x08 ? STREN0(b.value_) : - STREN0(b.value_);
|
int sv0b = (b.value_ & 0x08) ? STREN0(b.value_) : - STREN0(b.value_);
|
||||||
|
|
||||||
int sv1 = sv1a;
|
int sv1 = sv1a;
|
||||||
int sv0 = sv0a;
|
int sv0 = sv0a;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue