Remove some more cppcheck warnings and a valgrind compile warning

This commit is contained in:
Cary R 2013-04-30 18:34:33 -07:00
parent 51d3c03922
commit 1b1aa06dee
6 changed files with 16 additions and 11 deletions

View File

@ -4,6 +4,7 @@
// fstapi.c from GTKWave
obsoleteFunctionsasctime:fstapi.c:652
unreadVariable:fstapi.c:1297
variableScope:fstapi.c:751
variableScope:fstapi.c:1707
variableScope:fstapi.c:1965

View File

@ -1,7 +1,7 @@
#ifndef __symbols_H
#define __symbols_H
/*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2013 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
@ -69,6 +69,7 @@ class symbol_table_s {
symbol_value_t sym_get_value(const char*key);
private:
symbol_table_s(const symbol_table_s&) { assert(0); };
struct tree_node_*root;
struct key_strings*str_chunk;
unsigned str_used;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2013 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
@ -1009,7 +1009,7 @@ void vpip_put_value_event::run_run()
static t_vpi_time *timedup(t_vpi_time *val)
{
t_vpi_time *rtn;
rtn = (t_vpi_time *) malloc(sizeof(t_vpi_time));
rtn = static_cast<t_vpi_time *> (malloc(sizeof(t_vpi_time)));
*rtn = *val;
return rtn;
}
@ -1021,7 +1021,7 @@ static t_vpi_vecval *vectordup(t_vpi_vecval *val, PLI_INT32 size)
t_vpi_vecval *rtn;
assert(size > 0);
num_bytes = ((size + 31)/32)*sizeof(t_vpi_vecval);
rtn = (t_vpi_vecval *) malloc(num_bytes);
rtn = static_cast<t_vpi_vecval *> (malloc(num_bytes));
memcpy(rtn, val, num_bytes);
return rtn;
}
@ -1030,7 +1030,8 @@ static t_vpi_vecval *vectordup(t_vpi_vecval *val, PLI_INT32 size)
static t_vpi_strengthval *strengthdup(t_vpi_strengthval *val)
{
t_vpi_strengthval *rtn;
rtn = (t_vpi_strengthval *) malloc(sizeof(t_vpi_strengthval));
rtn = static_cast<t_vpi_strengthval *>
(malloc(sizeof(t_vpi_strengthval)));
*rtn = *val;
return rtn;
}

View File

@ -54,7 +54,8 @@ void port_delete(__vpiHandle*handle);
static void delete_sub_scopes(struct __vpiScope *scope)
{
for (unsigned idx = 0; idx < scope->nintern; idx += 1) {
struct __vpiScope*lscope = (__vpiScope*)(scope->intern)[idx];
struct __vpiScope*lscope = static_cast<__vpiScope*>
((scope->intern)[idx]);
switch(scope->intern[idx]->get_type_code()) {
case vpiFunction:
case vpiTask:
@ -128,7 +129,8 @@ static void delete_sub_scopes(struct __vpiScope *scope)
void root_table_delete(void)
{
for (unsigned idx = 0; idx < vpip_root_table_cnt; idx += 1) {
struct __vpiScope *scope = (__vpiScope *)vpip_root_table_ptr[idx];
struct __vpiScope *scope = static_cast<__vpiScope *>
(vpip_root_table_ptr[idx]);
delete_sub_scopes(scope);
vthreads_delete(scope);
delete scope;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2013 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
@ -1054,7 +1054,7 @@ void __vpiSignal::operator delete(void*)
#ifdef CHECK_WITH_VALGRIND
void signal_delete(vpiHandle item)
{
struct __vpiSignal *obj = (__vpiSignal *) item;
struct __vpiSignal *obj = static_cast<__vpiSignal *> (item);
assert(obj->node->fil);
obj->node->fil->clear_all_callbacks();
vvp_net_delete(obj->node);

View File

@ -594,9 +594,9 @@ vvp_fun_signal_string_sa::vvp_fun_signal_string_sa()
}
#ifdef CHECK_WITH_VALGRIND
void vvp_fun_signal_string_aa::free_instance(vvp_context_t context)
void vvp_fun_signal_string_aa::free_instance(vvp_context_t)
{
// Never knew how to do this!
assert(0);
}
#endif