cppcheck cleanup

This commit is contained in:
Cary R 2026-07-20 21:22:59 -07:00
parent 1cf8133420
commit f5e496b032
16 changed files with 77 additions and 71 deletions

View File

@ -15,9 +15,9 @@ constVariablePointer:main.cc:425
constVariablePointer:main.cc:675 constVariablePointer:main.cc:675
// const auto should be const // const auto should be const
constVariablePointer:elab_expr.cc:344 constVariablePointer:elab_expr.cc:566
constVariablePointer:elab_expr.cc:347 constVariablePointer:elab_expr.cc:569
constVariablePointer:elab_expr.cc:416 constVariablePointer:elab_expr.cc:638
// The reference cannot be const since it is updated in the calling function. // The reference cannot be const since it is updated in the calling function.
constParameterReference:net_udp.cc:37 constParameterReference:net_udp.cc:37
@ -36,7 +36,7 @@ uninitMemberVar:t-dll.cc:41
uninitMemberVar:t-dll.cc:109 uninitMemberVar:t-dll.cc:109
// By convention we put statics at the top scope. // By convention we put statics at the top scope.
variableScope:pform.cc:3499 variableScope:pform.cc:3632
// These are correct and are used to find the base (zero) pin. // These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:5376 thisSubtraction:netlist.h:5376
@ -52,7 +52,7 @@ knownConditionTrueFalse:elab_sig.cc:272
knownConditionTrueFalse:elab_sig.cc:345 knownConditionTrueFalse:elab_sig.cc:345
// Yes, it's a duplicate // Yes, it's a duplicate
duplicateCondition:elaborate.cc:8021 duplicateCondition:elaborate.cc:8190
// To complicated to use std::find_if() // To complicated to use std::find_if()
useStlAlgorithm:map_named_args.cc:38 useStlAlgorithm:map_named_args.cc:38
@ -718,9 +718,9 @@ unusedFunction:t-dll-api.cc:980
// has_compat_attributes() // has_compat_attributes()
unusedFunction:Attrib.cc:72 unusedFunction:Attrib.cc:72
// bl_type() // bl_type()
unusedFunction:Statement.h:192 unusedFunction:Statement.h:194
// chain_args() // chain_args()
unusedFunction:Statement.h:341 unusedFunction:Statement.h:369
// gn_modules_nest() // gn_modules_nest()
unusedFunction:compiler.h:247 unusedFunction:compiler.h:247
// driven_mask() // driven_mask()
@ -734,7 +734,7 @@ unusedFunction:net_link.cc:687
// get_def_fileline() // get_def_fileline()
unusedFunction:net_scope.cc:201 unusedFunction:net_scope.cc:201
// get_module_port_info() // get_module_port_info()
unusedFunction:net_scope.cc:600 unusedFunction:net_scope.cc:617
// find_link_signal() // find_link_signal()
unusedFunction:netlist.cc:113 unusedFunction:netlist.cc:113
// find_link() // find_link()

View File

@ -1,6 +1,6 @@
// cppcheck is wrong this is correct usage // cppcheck is wrong this is correct usage
syntaxError:main.c:410 syntaxError:main.c:415
syntaxError:main.c:413 syntaxError:main.c:412
// cppcheck is missing the code adds a \0 at the previous location. // cppcheck is missing the code adds a \0 at the previous location.
knownConditionTrueFalse:main.c:1123 knownConditionTrueFalse:main.c:1123

View File

@ -256,7 +256,7 @@ static const netclass_t* resolve_call_chain_prefix_class(Design*des, NetScope*sc
NetFuncDef* fundef = sr.scope->func_def(); NetFuncDef* fundef = sr.scope->func_def();
ivl_assert(*link, fundef); ivl_assert(*link, fundef);
NetScope* dscope = fundef->scope(); NetScope* dscope = fundef->scope();
NetNet* res = dscope->find_signal(dscope->basename()); const NetNet* res = dscope->find_signal(dscope->basename());
if (res == 0) return 0; if (res == 0) return 0;
return dynamic_cast<const netclass_t*>(res->net_type()); return dynamic_cast<const netclass_t*>(res->net_type());
} }
@ -271,9 +271,9 @@ static const netclass_t* resolve_call_chain_prefix_class(Design*des, NetScope*sc
perm_string mname = peek_tail_name(link->peek_path()); perm_string mname = peek_tail_name(link->peek_path());
NetScope* mscope = recv_class->method_from_name(mname); NetScope* mscope = recv_class->method_from_name(mname);
if (mscope == 0) return 0; if (mscope == 0) return 0;
NetFuncDef* mdef = mscope->func_def(); const NetFuncDef* mdef = mscope->func_def();
if (mdef == 0) return 0; if (mdef == 0) return 0;
NetNet* mres = mscope->find_signal(mscope->basename()); const NetNet* mres = mscope->find_signal(mscope->basename());
if (mres == 0) return 0; if (mres == 0) return 0;
return dynamic_cast<const netclass_t*>(mres->net_type()); return dynamic_cast<const netclass_t*>(mres->net_type());
} }
@ -2040,10 +2040,10 @@ unsigned PECallFunction::test_width_chain_(Design*des, NetScope*scope,
NetScope* mscope = cls->method_from_name(mname); NetScope* mscope = cls->method_from_name(mname);
if (mscope == 0) return 0; if (mscope == 0) return 0;
NetFuncDef* mdef = mscope->func_def(); const NetFuncDef* mdef = mscope->func_def();
if (mdef == 0 || mdef->is_void()) return 0; if (mdef == 0 || mdef->is_void()) return 0;
NetNet* mres = mscope->find_signal(mscope->basename()); const NetNet* mres = mscope->find_signal(mscope->basename());
if (mres == 0) return 0; if (mres == 0) return 0;
expr_type_ = mres->data_type(); expr_type_ = mres->data_type();
@ -3723,7 +3723,7 @@ NetExpr* PECallFunction::elaborate_expr_method_chained_(Design*des, NetScope*sco
method_name, &no_parms); method_name, &no_parms);
if (step == 0) return 0; if (step == 0) return 0;
NetEUFunc*uf = dynamic_cast<NetEUFunc*> (step); const NetEUFunc*uf = dynamic_cast<NetEUFunc*> (step);
if (uf == 0) { if (uf == 0) {
cerr << get_fileline() << ": internal error: " cerr << get_fileline() << ": internal error: "
<< "expected class method call to be NetEUFunc." << endl; << "expected class method call to be NetEUFunc." << endl;

View File

@ -518,7 +518,7 @@ bool PGenerate::elaborate_sig(Design*des, NetScope*container) const
typedef list<PGenerate*>::const_iterator generate_it_t; typedef list<PGenerate*>::const_iterator generate_it_t;
for (generate_it_t cur = generate_schemes.begin() for (generate_it_t cur = generate_schemes.begin()
; cur != generate_schemes.end() ; ++ cur ) { ; cur != generate_schemes.end() ; ++ cur ) {
PGenerate*item = *cur; const PGenerate*item = *cur;
if (item->directly_nested || !item->scope_list_.empty()) { if (item->directly_nested || !item->scope_list_.empty()) {
flag &= item->elaborate_sig(des, container); flag &= item->elaborate_sig(des, container);
} }
@ -566,7 +566,7 @@ bool PGenerate::elaborate_sig_direct_(Design*des, NetScope*container) const
if (item->scheme_type == PGenerate::GS_CASE) { if (item->scheme_type == PGenerate::GS_CASE) {
for (generate_it_t icur = item->generate_schemes.begin() for (generate_it_t icur = item->generate_schemes.begin()
; icur != item->generate_schemes.end() ; ++ icur ) { ; icur != item->generate_schemes.end() ; ++ icur ) {
PGenerate*case_item = *icur; const PGenerate*case_item = *icur;
if (case_item->directly_nested || !case_item->scope_list_.empty()) { if (case_item->directly_nested || !case_item->scope_list_.empty()) {
flag &= case_item->elaborate_sig(des, container); flag &= case_item->elaborate_sig(des, container);
} }

View File

@ -3599,7 +3599,7 @@ NetProc* PCase::elaborate(Design*des, NetScope*scope) const
separate item. */ separate item. */
unsigned icount = 0; unsigned icount = 0;
for (unsigned idx = 0 ; idx < items_->size() ; idx += 1) { for (unsigned idx = 0 ; idx < items_->size() ; idx += 1) {
PCase::Item*cur = (*items_)[idx]; const PCase::Item*cur = (*items_)[idx];
if (cur->expr.empty()) if (cur->expr.empty())
icount += 1; icount += 1;
@ -7300,7 +7300,7 @@ bool PGenerate::elaborate(Design*des, NetScope*container) const
typedef list<PGenerate*>::const_iterator generate_it_t; typedef list<PGenerate*>::const_iterator generate_it_t;
for (generate_it_t cur = generate_schemes.begin() for (generate_it_t cur = generate_schemes.begin()
; cur != generate_schemes.end() ; ++ cur ) { ; cur != generate_schemes.end() ; ++ cur ) {
PGenerate*item = *cur; const PGenerate*item = *cur;
if (item->directly_nested || !item->scope_list_.empty()) { if (item->directly_nested || !item->scope_list_.empty()) {
flag &= item->elaborate(des, container); flag &= item->elaborate(des, container);
} }
@ -7375,7 +7375,7 @@ bool PGenerate::elaborate_direct_(Design*des, NetScope*container) const
if (item->scheme_type == PGenerate::GS_CASE) { if (item->scheme_type == PGenerate::GS_CASE) {
for (generate_it_t icur = item->generate_schemes.begin() for (generate_it_t icur = item->generate_schemes.begin()
; icur != item->generate_schemes.end() ; ++ icur ) { ; icur != item->generate_schemes.end() ; ++ icur ) {
PGenerate*case_item = *icur; const PGenerate*case_item = *icur;
if (case_item->directly_nested || !case_item->scope_list_.empty()) { if (case_item->directly_nested || !case_item->scope_list_.empty()) {
flag &= case_item->elaborate(des, container); flag &= case_item->elaborate(des, container);
} }
@ -7966,7 +7966,7 @@ static void check_timescales()
} }
for (pkg = pform_units.begin(); pkg != pform_units.end(); ++pkg) { for (pkg = pform_units.begin(); pkg != pform_units.end(); ++pkg) {
PPackage*pp = *pkg; const PPackage*pp = *pkg;
if (pp->has_explicit_timescale()) if (pp->has_explicit_timescale())
continue; continue;

View File

@ -797,7 +797,7 @@ bool NetForever::evaluate_function(const LineInfo&loc,
} }
while (flag && !disable) { while (flag && !disable) {
flag = flag && statement_->evaluate_function(loc, context_map); flag = statement_->evaluate_function(loc, context_map);
if (loop_break) { if (loop_break) {
loop_break = false; loop_break = false;
@ -903,7 +903,7 @@ bool NetRepeat::evaluate_function(const LineInfo&loc,
} }
while ((count > 0) && flag && !disable) { while ((count > 0) && flag && !disable) {
flag = flag && statement_->evaluate_function(loc, context_map); flag = statement_->evaluate_function(loc, context_map);
count -= 1; count -= 1;
if (loop_break) { if (loop_break) {

View File

@ -5532,7 +5532,7 @@ module_item
*/ */
| attribute_list_opt K_inout list_of_port_identifiers ';' | attribute_list_opt K_inout list_of_port_identifiers ';'
{ NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
} }
@ -5544,7 +5544,7 @@ module_item
| attribute_list_opt K_input list_of_port_identifiers ';' | attribute_list_opt K_input list_of_port_identifiers ';'
{ NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
} }
@ -5556,7 +5556,7 @@ module_item
| attribute_list_opt K_output list_of_variable_port_identifiers ';' | attribute_list_opt K_output list_of_variable_port_identifiers ';'
{ NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3.type ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3.type)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
else else

View File

@ -2133,7 +2133,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
local_errors += 1; local_errors += 1;
} }
auto*pa = dynamic_cast<PAssign*>(init_expr); const auto*pa = dynamic_cast<PAssign*>(init_expr);
if (!pa) { if (!pa) {
cerr << init_expr->get_fileline() << ": error: " cerr << init_expr->get_fileline() << ": error: "
<< "Invalid initial statement for primitive " << "Invalid initial statement for primitive "
@ -3107,7 +3107,7 @@ void pform_set_parameter(const struct vlltype&loc,
} }
} }
vector_type_t*vt = dynamic_cast<vector_type_t*>(data_type); const vector_type_t*vt = dynamic_cast<vector_type_t*>(data_type);
if (vt && vt->pdims && vt->pdims->size() > 1) { if (vt && vt->pdims && vt->pdims->size() > 1) {
if (pform_requires_sv(loc, "packed array parameter")) { if (pform_requires_sv(loc, "packed array parameter")) {
VLerror(loc, "sorry: packed array parameters are not supported yet."); VLerror(loc, "sorry: packed array parameters are not supported yet.");

View File

@ -32,7 +32,7 @@
bool dll_target::process(const NetAnalogTop*net) bool dll_target::process(const NetAnalogTop*net)
{ {
bool rc_flag = true; bool rc_flag;
ivl_process_t obj = static_cast<struct ivl_process_s*> ivl_process_t obj = static_cast<struct ivl_process_s*>
(calloc(1, sizeof(struct ivl_process_s))); (calloc(1, sizeof(struct ivl_process_s)));
@ -50,7 +50,7 @@ bool dll_target::process(const NetAnalogTop*net)
assert(stmt_cur_ == 0); assert(stmt_cur_ == 0);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_)); stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
rc_flag = net->statement()->emit_proc(this) && rc_flag; rc_flag = net->statement()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
obj->stmt_ = stmt_cur_; obj->stmt_ = stmt_cur_;

View File

@ -34,7 +34,7 @@
bool dll_target::process(const NetProcTop*net) bool dll_target::process(const NetProcTop*net)
{ {
bool rc_flag = true; bool rc_flag;
ivl_process_t obj = static_cast<struct ivl_process_s*> ivl_process_t obj = static_cast<struct ivl_process_s*>
(calloc(1, sizeof(struct ivl_process_s))); (calloc(1, sizeof(struct ivl_process_s)));
@ -62,7 +62,7 @@ bool dll_target::process(const NetProcTop*net)
assert(stmt_cur_ == 0); assert(stmt_cur_ == 0);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_)); stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
rc_flag = net->statement()->emit_proc(this) && rc_flag; rc_flag = net->statement()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
obj->stmt_ = stmt_cur_; obj->stmt_ = stmt_cur_;
@ -733,7 +733,7 @@ void dll_target::proc_forever(const NetForever*net)
bool dll_target::proc_forloop(const NetForLoop*net) bool dll_target::proc_forloop(const NetForLoop*net)
{ {
ivl_statement_t tmp; ivl_statement_t tmp;
bool rc, res=true; bool rc, res;
assert(stmt_cur_); assert(stmt_cur_);
assert(stmt_cur_->type_ == IVL_ST_NONE); assert(stmt_cur_->type_ == IVL_ST_NONE);
@ -753,7 +753,7 @@ bool dll_target::proc_forloop(const NetForLoop*net)
free(tmp); free(tmp);
save_cur_->u_.forloop_.init_stmt = nullptr; save_cur_->u_.forloop_.init_stmt = nullptr;
} }
res = res && rc; res = rc;
tmp = static_cast<struct ivl_statement_s*>(calloc(1, sizeof(struct ivl_statement_s))); tmp = static_cast<struct ivl_statement_s*>(calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_ = tmp; stmt_cur_ = tmp;

View File

@ -1,8 +1,11 @@
// We use guarded memory allocation routines, but cppcheck is not // We use guarded memory allocation routines, but cppcheck is not
// noticing this so it is complaining we could return a NULL value. // noticing this so it is complaining we could return a NULL value.
nullPointerOutOfMemory:logic_lpm.c:2143 // strdup @ 2140 nullPointerOutOfMemory:logic_lpm.c:2148 // strdup @ 2145
nullPointerOutOfMemory:logic_lpm.c:2247 // strdup @ 2244 nullPointerOutOfMemory:logic_lpm.c:2252 // strdup @ 2249
nullPointerOutOfMemory:misc.c:39 // malloc @ 38 nullPointerOutOfMemory:misc.c:39 // malloc @ 38
nullPointerOutOfMemory:misc.c:44 // malloc @ 38
nullPointerOutOfMemory:misc.c:45 // malloc @ 38
nullPointerOutOfMemory:misc.c:48 // malloc @ 38
nullPointerOutOfMemory:misc.c:794 // malloc @ 793 nullPointerOutOfMemory:misc.c:794 // malloc @ 793
nullPointerOutOfMemory:misc.c:795 // malloc @ 793 nullPointerOutOfMemory:misc.c:795 // malloc @ 793
nullPointerOutOfMemory:numbers.c:362 // strdup @ 359 nullPointerOutOfMemory:numbers.c:362 // strdup @ 359

View File

@ -4,8 +4,8 @@ nullPointerOutOfMemory:vvp.c:90 // malloc @ 89
nullPointerOutOfMemory:vvp.c:91 // malloc @ 89 nullPointerOutOfMemory:vvp.c:91 // malloc @ 89
nullPointerOutOfMemory:vvp.c:92 // malloc @ 89 nullPointerOutOfMemory:vvp.c:92 // malloc @ 89
nullPointerOutOfMemory:draw_mux.c:83 // strdup @ 80 nullPointerOutOfMemory:draw_mux.c:83 // strdup @ 80
nullPointerOutOfMemory:draw_mux.c:95 // strdup @ 80 nullPointerOutOfMemory:draw_mux.c:99 // strdup @ 80
nullPointerOutOfMemory:draw_mux.c:110 // strdup @ 80 nullPointerOutOfMemory:draw_mux.c:114 // strdup @ 80
nullPointerOutOfMemory:draw_net_input.c:92 // malloc @ 90 nullPointerOutOfMemory:draw_net_input.c:92 // malloc @ 90
nullPointerOutOfMemory:draw_net_input.c:93 // malloc @ 90 nullPointerOutOfMemory:draw_net_input.c:93 // malloc @ 90
nullPointerOutOfMemory:draw_net_input.c:118 // malloc @ 110 nullPointerOutOfMemory:draw_net_input.c:118 // malloc @ 110
@ -17,17 +17,20 @@ nullPointerOutOfMemory:draw_net_input.c:257 // malloc @ 248
nullPointerOutOfMemory:draw_net_input.c:269 // malloc @ 235 nullPointerOutOfMemory:draw_net_input.c:269 // malloc @ 235
nullPointerOutOfMemory:draw_net_input.c:667 // malloc @ 665 nullPointerOutOfMemory:draw_net_input.c:667 // malloc @ 665
nullPointerOutOfMemory:draw_net_input.c:668 // malloc @ 665 nullPointerOutOfMemory:draw_net_input.c:668 // malloc @ 665
nullPointerOutOfMemory:draw_net_input.c:774 // malloc @ 761
nullPointerOutOfMemory:draw_net_input.c:779 // malloc @ 761 nullPointerOutOfMemory:draw_net_input.c:779 // malloc @ 761
nullPointerOutOfMemory:draw_net_input.c:780 // malloc @ 761 nullPointerOutOfMemory:draw_net_input.c:780 // malloc @ 761
nullPointerOutOfMemory:modpath.c:75 // calloc @ 68 nullPointerOutOfMemory:modpath.c:75 // calloc @ 68
nullPointerOutOfMemory:modpath.c:79 // calloc @ 69
nullPointerOutOfMemory:modpath.c:92 // calloc @ 68 nullPointerOutOfMemory:modpath.c:92 // calloc @ 68
nullPointerOutOfMemory:modpath.c:111 // calloc @ 69 nullPointerOutOfMemory:modpath.c:111 // calloc @ 69
nullPointerOutOfMemory:modpath.c:139 // calloc @ 138 nullPointerOutOfMemory:modpath.c:139 // calloc @ 138
nullPointerOutOfMemory:modpath.c:140 // calloc @ 138 nullPointerOutOfMemory:modpath.c:140 // calloc @ 138
nullPointerOutOfMemory:modpath.c:141 // calloc @ 138 nullPointerOutOfMemory:modpath.c:141 // calloc @ 138
nullPointerOutOfMemory:modpath.c:142 // calloc @ 138 nullPointerOutOfMemory:modpath.c:142 // calloc @ 138
nullPointerOutOfMemory:vvp_process.c:2120 // malloc @ 2118 nullPointerOutOfMemory:vvp_process.c:2218 // malloc @ 2216
nullPointerOutOfMemory:vvp_process.c:2121 // malloc @ 2118 nullPointerOutOfMemory:vvp_process.c:2219 // malloc @ 2216
nullPointerOutOfMemory:vvp_scope.c:876 // calloc @ 865
nullPointerOutOfMemory:vvp_scope.c:900 // calloc @ 865 nullPointerOutOfMemory:vvp_scope.c:900 // calloc @ 865
nullPointerOutOfMemory:vvp_scope.c:1094 // calloc @ 1092 nullPointerOutOfMemory:vvp_scope.c:1094 // calloc @ 1092
nullPointerOutOfMemory:vvp_scope.c:1117 // calloc @ 1092 nullPointerOutOfMemory:vvp_scope.c:1117 // calloc @ 1092

View File

@ -36,7 +36,7 @@ static void show_prop_type_vector(ivl_type_t ptype)
fprintf(vvp_out, "\"%s%c1\"", signed_flag, code); fprintf(vvp_out, "\"%s%c1\"", signed_flag, code);
} else { } else {
fprintf(vvp_out, "\"%s%c%d\"", signed_flag, code, fprintf(vvp_out, "\"%s%c%u\"", signed_flag, code,
ivl_type_packed_width(ptype)); ivl_type_packed_width(ptype));
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2026 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
@ -463,7 +463,7 @@ static void emit_queue_with_on_match(enum queue_locator_with_mode_e mode,
fprintf(vvp_out, " %%queue/new_empty/v;\n"); fprintf(vvp_out, " %%queue/new_empty/v;\n");
} }
if (as_index) { if (as_index) {
fprintf(vvp_out, " %%push/ix/vec4 %u, 32, 1;\n", i_reg); fprintf(vvp_out, " %%push/ix/vec4 %d, 32, 1;\n", i_reg);
fprintf(vvp_out, " %%queue/append_word/v 32;\n"); fprintf(vvp_out, " %%queue/append_word/v 32;\n");
} else { } else {
fprintf(vvp_out, " %%load/vec4 v%p_0;\n", item_sig); fprintf(vvp_out, " %%load/vec4 v%p_0;\n", item_sig);
@ -475,12 +475,12 @@ static void emit_queue_with_on_match(enum queue_locator_with_mode_e mode,
static void emit_queue_with_init_index(int reverse, int i_reg, int n_reg) static void emit_queue_with_init_index(int reverse, int i_reg, int n_reg)
{ {
if (!reverse) { if (!reverse) {
fprintf(vvp_out, " %%ix/load %u, 0, 0;\n", i_reg); fprintf(vvp_out, " %%ix/load %d, 0, 0;\n", i_reg);
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n"); fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
} else { } else {
fprintf(vvp_out, " %%ix/load %u, 0, 0;\n", i_reg); fprintf(vvp_out, " %%ix/load %d, 0, 0;\n", i_reg);
fprintf(vvp_out, " %%ix/mov %u, %u;\n", i_reg, n_reg); fprintf(vvp_out, " %%ix/mov %d, %d;\n", i_reg, n_reg);
fprintf(vvp_out, " %%ix/sub %u, 1, 0;\n", i_reg); fprintf(vvp_out, " %%ix/sub %d, 1, 0;\n", i_reg);
} }
} }
@ -488,11 +488,11 @@ static void emit_queue_with_loop_test(int reverse, int i_reg, int n_reg,
unsigned lab_loop_end) unsigned lab_loop_end)
{ {
if (!reverse) { if (!reverse) {
fprintf(vvp_out, " %%cmpix/ltu %u, %u;\n", i_reg, n_reg); fprintf(vvp_out, " %%cmpix/ltu %d, %d;\n", i_reg, n_reg);
fprintf(vvp_out, " %%jmp/0 T_%u.%u, 4;\n", thread_count, fprintf(vvp_out, " %%jmp/0 T_%u.%u, 4;\n", thread_count,
lab_loop_end); lab_loop_end);
} else { } else {
fprintf(vvp_out, " %%cmpix/slt0 %u;\n", i_reg); fprintf(vvp_out, " %%cmpix/slt0 %d;\n", i_reg);
fprintf(vvp_out, " %%jmp/1 T_%u.%u, 4;\n", thread_count, fprintf(vvp_out, " %%jmp/1 T_%u.%u, 4;\n", thread_count,
lab_loop_end); lab_loop_end);
} }
@ -501,9 +501,9 @@ static void emit_queue_with_loop_test(int reverse, int i_reg, int n_reg,
static void emit_queue_with_step_index(int reverse, int i_reg, unsigned lab_top) static void emit_queue_with_step_index(int reverse, int i_reg, unsigned lab_top)
{ {
if (!reverse) { if (!reverse) {
fprintf(vvp_out, " %%ix/add %u, 1, 0;\n", i_reg); fprintf(vvp_out, " %%ix/add %d, 1, 0;\n", i_reg);
} else { } else {
fprintf(vvp_out, " %%ix/sub %u, 1, 0;\n", i_reg); fprintf(vvp_out, " %%ix/sub %d, 1, 0;\n", i_reg);
} }
fprintf(vvp_out, " %%jmp T_%u.%u;\n", thread_count, lab_top); fprintf(vvp_out, " %%jmp T_%u.%u;\n", thread_count, lab_top);
} }
@ -577,7 +577,7 @@ static int eval_queue_method_find_with(ivl_expr_t expr)
unsigned pidx = ivl_expr_property_idx(qarg); unsigned pidx = ivl_expr_property_idx(qarg);
fprintf(vvp_out, " %%load/obj v%p_0;\n", cl); fprintf(vvp_out, " %%load/obj v%p_0;\n", cl);
fprintf(vvp_out, " %%prop/queue/size %u;\n", pidx); fprintf(vvp_out, " %%prop/queue/size %u;\n", pidx);
fprintf(vvp_out, " %%ix/vec4/s %u;\n", n_reg); fprintf(vvp_out, " %%ix/vec4/s %d;\n", n_reg);
if (multi) { if (multi) {
fprintf(vvp_out, " %%queue/new_empty/v;\n"); fprintf(vvp_out, " %%queue/new_empty/v;\n");
} }
@ -586,12 +586,12 @@ static int eval_queue_method_find_with(ivl_expr_t expr)
emit_queue_with_loop_test(reverse, i_reg, n_reg, lab_loop_end); emit_queue_with_loop_test(reverse, i_reg, n_reg, lab_loop_end);
/* cmpix leaves flag 4 set; %queue/word* uses flag 4 for X push */ /* cmpix leaves flag 4 set; %queue/word* uses flag 4 for X push */
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n"); fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
fprintf(vvp_out, " %%queue/word/prop/v %u, %u, %u;\n", pidx, fprintf(vvp_out, " %%queue/word/prop/v %u, %u, %d;\n", pidx,
elem_wid, i_reg); elem_wid, i_reg);
} else { } else {
ivl_signal_t sig = ivl_expr_signal(qarg); ivl_signal_t sig = ivl_expr_signal(qarg);
fprintf(vvp_out, " %%queue/size/v v%p_0;\n", sig); fprintf(vvp_out, " %%queue/size/v v%p_0;\n", sig);
fprintf(vvp_out, " %%ix/vec4/s %u;\n", n_reg); fprintf(vvp_out, " %%ix/vec4/s %d;\n", n_reg);
if (multi) { if (multi) {
fprintf(vvp_out, " %%queue/new_empty/v;\n"); fprintf(vvp_out, " %%queue/new_empty/v;\n");
} }
@ -600,12 +600,12 @@ static int eval_queue_method_find_with(ivl_expr_t expr)
lab_top); lab_top);
emit_queue_with_loop_test(reverse, i_reg, n_reg, lab_loop_end); emit_queue_with_loop_test(reverse, i_reg, n_reg, lab_loop_end);
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n"); fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
fprintf(vvp_out, " %%queue/word/v v%p_0, %u, %u;\n", sig, elem_wid, fprintf(vvp_out, " %%queue/word/v v%p_0, %u, %d;\n", sig, elem_wid,
i_reg); i_reg);
} }
fprintf(vvp_out, " %%store/vec4 v%p_0, 0, %u;\n", item_sig, elem_wid); fprintf(vvp_out, " %%store/vec4 v%p_0, 0, %u;\n", item_sig, elem_wid);
fprintf(vvp_out, " %%push/ix/vec4 %u, 32, 1;\n", i_reg); fprintf(vvp_out, " %%push/ix/vec4 %d, 32, 1;\n", i_reg);
fprintf(vvp_out, " %%store/vec4 v%p_0, 0, 32;\n", idx_sig); fprintf(vvp_out, " %%store/vec4 v%p_0, 0, 32;\n", idx_sig);
int pf = draw_eval_condition(pred); int pf = draw_eval_condition(pred);

View File

@ -5,7 +5,7 @@ nullPointerOutOfMemory
memleakOnRealloc memleakOnRealloc
// We check memory allocation with valgrind // We check memory allocation with valgrind
nullPointer:sys_display.c:931 nullPointer:sys_display.c:960
// Skip asctime() obsolete for now. // Skip asctime() obsolete for now.
asctimeCalled:sys_fst.c:381 asctimeCalled:sys_fst.c:381
@ -38,10 +38,10 @@ uninitvar:sys_random.c:267
// The interface is from the standard. // The interface is from the standard.
constParameterCallback:sys_convert.c:150 constParameterCallback:sys_convert.c:150
constParameterCallback:sys_display.c:1281 constParameterCallback:sys_display.c:1311
constParameterCallback:sys_display.c:1379 constParameterCallback:sys_display.c:1409
constParameterCallback:sys_display.c:1553 constParameterCallback:sys_display.c:1583
constParameterCallback:sys_display.c:2174 constParameterCallback:sys_display.c:2204
constParameterCallback:sys_fileio.c:261 constParameterCallback:sys_fileio.c:261
constParameterCallback:sys_random.c:497 constParameterCallback:sys_random.c:497
constParameterCallback:sys_sdf.c:437 constParameterCallback:sys_sdf.c:437

View File

@ -78,7 +78,7 @@ duplInheritedMember:symbols.h:112
duplicateValueTernary:class_type.cc:268 duplicateValueTernary:class_type.cc:268
// cppcheck is wrong this can be true or false // cppcheck is wrong this can be true or false
knownConditionTrueFalse:vthread.cc:2986 knownConditionTrueFalse:vthread.cc:3625
knownConditionTrueFalse:vpi_priv.cc:681 knownConditionTrueFalse:vpi_priv.cc:681
knownConditionTrueFalse:vpi_priv.cc:2030 knownConditionTrueFalse:vpi_priv.cc:2030
@ -92,7 +92,7 @@ knownConditionTrueFalse:vthread.cc:3571
duplicateExpression:vpi_signal.cc:1207 duplicateExpression:vpi_signal.cc:1207
// cppcheck does not relize this is deleted[] in the called routine // cppcheck does not relize this is deleted[] in the called routine
leakNoVarFunctionCall:compile.cc:476 leakNoVarFunctionCall:compile.cc:508
// Yes, these are not currently initialized in the constructor // Yes, these are not currently initialized in the constructor
// All are added after __vpiSysTaskCall is built // All are added after __vpiSysTaskCall is built
@ -151,13 +151,13 @@ knownConditionTrueFalse:vpi_modules.cc:118
redundantAssignment:vpi_modules.cc:117 redundantAssignment:vpi_modules.cc:117
// cppcheck does not undestand the format types match // cppcheck does not undestand the format types match
invalidScanfArgType_int:compile.cc:621 invalidScanfArgType_int:compile.cc:653
invalidScanfArgType_int:compile.cc:627 invalidScanfArgType_int:compile.cc:659
invalidScanfArgType_int:compile.cc:633 invalidScanfArgType_int:compile.cc:665
invalidScanfArgType_int:vthread.cc:4580 invalidScanfArgType_int:vthread.cc:4634
invalidScanfArgType_int:vthread.cc:4583 invalidScanfArgType_int:vthread.cc:4637
invalidScanfArgType_int:vthread.cc:4586 invalidScanfArgType_int:vthread.cc:4640
invalidScanfArgType_int:vthread.cc:4589 invalidScanfArgType_int:vthread.cc:4643
// The new() operator is always used to allocate space for this class and // The new() operator is always used to allocate space for this class and
// pool is defined there. // pool is defined there.