diff --git a/Module.cc b/Module.cc index 75e1c0f8d..2602aee7a 100644 --- a/Module.cc +++ b/Module.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2022 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 @@ -148,7 +148,7 @@ bool Module::can_be_toplevel() const // Don't choose modules with parameters without default value for (std::map::const_iterator cur = - parameters.begin(); cur != parameters.end(); cur++) { + parameters.begin(); cur != parameters.end(); ++cur) { if (cur->second->expr == 0) return false; } diff --git a/cppcheck.sup b/cppcheck.sup index 6b9d3c9b8..b7b2ede5d 100644 --- a/cppcheck.sup +++ b/cppcheck.sup @@ -1,20 +1,20 @@ // These are correct and are used to find the base (zero) pin. -thisSubtraction:netlist.h:5213 -thisSubtraction:netlist.h:5222 +thisSubtraction:netlist.h:5244 +thisSubtraction:netlist.h:5253 // This is used when running a debugger // debugger_release -knownConditionTrueFalse:main.cc:919 +knownConditionTrueFalse:main.cc:921 // This are just stubs // vpi_control() -unusedFunction:vpi_modules.cc:107 +unusedFunction:vpi_modules.cc:109 // vpi_mcd_printf() -unusedFunction:vpi_modules.cc:84 +unusedFunction:vpi_modules.cc:86 // vpi_printf() -unusedFunction:vpi_modules.cc:88 +unusedFunction:vpi_modules.cc:90 // vpi_sim_control() -unusedFunction:vpi_modules.cc:108 +unusedFunction:vpi_modules.cc:110 // These are the functions that the compiler exports to the targets. //ivl_branch_island() diff --git a/elab_expr.cc b/elab_expr.cc index 6ee81e04f..af11c7559 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -2943,7 +2943,7 @@ unsigned PECallFunction::elaborate_arguments_(Design*des, NetScope*scope, for (unsigned idx = 0 ; idx < parm_count ; idx += 1) { unsigned pidx = idx + parm_off; - PExpr*tmp = (idx < actual_count) ? parms_[idx] : 0; + PExpr*tmp = (idx < actual_count) ? parms_[idx] : NULL; if (tmp) { parms[pidx] = elaborate_rval_expr(des, scope, def->port(pidx)->net_type(), @@ -3177,7 +3177,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, // Get the method name that we are looking for. perm_string method_name = search_results.path_tail.back().name; - PExpr*tmp = parms_.size() ? parms_[0] : 0; + PExpr*tmp = parms_.size() ? parms_[0] : NULL; return check_for_enum_methods(this, des, scope, netenum, path_, method_name, sub_expr, @@ -4171,7 +4171,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, width_mode_t&mode) ivl_assert(*this, 0); } - if (const netdarray_t*darray = sr.net ? sr.net->darray_type() : 0) { + if (const netdarray_t*darray = sr.net ? sr.net->darray_type() : NULL) { switch (use_sel) { case index_component_t::SEL_BIT: case index_component_t::SEL_BIT_LAST: diff --git a/elab_lval.cc b/elab_lval.cc index 3c8a82c69..3379b658e 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -183,7 +183,6 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, symbol_search(this, des, use_scope, path_, &sr); NetNet *reg = sr.net; - pform_name_t &base_path = sr.path_head; pform_name_t &member_path = sr.path_tail; /* The l-value must be a variable. If not, then give up and @@ -221,6 +220,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, else cerr << get_fileline() << ": " << __func__ << ": " << "reg->net_type()=" << endl; + const pform_name_t &base_path = sr.path_head; cerr << get_fileline() << ": " << __func__ << ": " << " base_path=" << base_path << ", member_path=" << member_path diff --git a/elab_net.cc b/elab_net.cc index ae00cd093..2e45929a0 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2012 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -1115,7 +1115,7 @@ NetNet*PEIdent::elaborate_unpacked_net(Design*des, NetScope*scope) const } const name_component_t&name_tail = path_.back(); - if (name_tail.index.size() != 0) { + if (!name_tail.index.empty()) { cerr << get_fileline() << ": sorry: Array slices are not yet " << "supported for continuous assignment." << endl; des->errors += 1; diff --git a/elab_scope.cc b/elab_scope.cc index 41723b95d..b58c098fc 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -415,7 +415,7 @@ static void blend_class_constructors(PClass*pclass) // While we're here, look for a super.new() call. If we find // it, strip it out of the constructor and set it aside for // when we actually call the chained constructor. - PChainConstructor*chain_new = use_new? use_new->extract_chain_constructor() : 0; + PChainConstructor*chain_new = use_new? use_new->extract_chain_constructor() : NULL; // If we do not have an explicit constructor chain, but there // is a parent class, then create an implicit chain. @@ -457,7 +457,6 @@ static void blend_class_constructors(PClass*pclass) } else { use_new->push_statement_front(chain_new); } - chain_new = 0; } } @@ -1153,7 +1152,6 @@ bool PGenerate::generate_scope_case_(Design*des, NetScope*container) } delete case_value_co; - case_value_co = 0; PGenerate*item = (cur == generate_schemes.end())? default_item : *cur; if (item == 0) { diff --git a/elaborate.cc b/elaborate.cc index 41ce06ca0..127ce71e3 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3422,8 +3422,8 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const // Well, I actually need to generate code to handle the // conditional, so elaborate. - NetProc*i = if_? if_->elaborate(des, scope) : 0; - NetProc*e = else_? else_->elaborate(des, scope) : 0; + NetProc*i = if_? if_->elaborate(des, scope) : NULL; + NetProc*e = else_? else_->elaborate(des, scope) : NULL; // Detect the special cases that the if or else statements are // empty blocks. If this is the case, remove the blocks as diff --git a/eval_tree.cc b/eval_tree.cc index b9cb59e0e..e55305a51 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2022 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 @@ -153,7 +153,7 @@ NetExpr* NetEBAdd::eval_tree() // example, the expression (a + 2) - 1 can be rewritten as a + 1. NetEBAdd*se = dynamic_cast(left_); - NetEConst*lc = se? dynamic_cast(se->right_) : 0; + NetEConst*lc = se? dynamic_cast(se->right_) : NULL; NetEConst*rc = dynamic_cast(right_); if (lc != 0 && rc != 0) { diff --git a/functor.cc b/functor.cc index d32a5d36e..f54106a00 100644 --- a/functor.cc +++ b/functor.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2022 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 @@ -176,7 +176,7 @@ void Design::functor(functor_t*fun) break; nodes_functor_cur_ = nodes_functor_nxt_; - } while (nodes_ && (nodes_functor_cur_ != nodes_)); + } while (nodes_functor_cur_ != nodes_); nodes_functor_cur_ = 0; nodes_functor_nxt_ = 0; diff --git a/lexor.lex b/lexor.lex index aca434fe9..14efed00b 100644 --- a/lexor.lex +++ b/lexor.lex @@ -80,7 +80,7 @@ char* yytext_string_filter(const char*str, size_t str_len) char* strdupnew(char const *str) { - return str ? strcpy(new char [strlen(str)+1], str) : 0; + return str ? strcpy(new char [strlen(str)+1], str) : NULL; } static const char* set_file_name(char*text) diff --git a/main.cc b/main.cc index 0c20b15cc..187ab9611 100644 --- a/main.cc +++ b/main.cc @@ -1,5 +1,5 @@ const char COPYRIGHT[] = - "Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)"; + "Copyright (c) 1998-2022 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 @@ -1327,8 +1327,7 @@ int main(int argc, char*argv[]) delete des; EOC_cleanup(); return 1; - } - if (emit_rc < 0) { + } else { cerr << "error: Code generator failure: " << emit_rc << endl; delete des; EOC_cleanup(); diff --git a/net_design.cc b/net_design.cc index b9990365c..a94582901 100644 --- a/net_design.cc +++ b/net_design.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 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 @@ -829,9 +829,9 @@ void NetScope::evaluate_type_parameter_(Design *des, param_ref_t cur) return; } - data_type_t *type = type_expr->get_type(); + data_type_t *ptype = type_expr->get_type(); NetScope *type_scope = cur->second.val_scope; - cur->second.ivl_type = type->elaborate_type(des, type_scope); + cur->second.ivl_type = ptype->elaborate_type(des, type_scope); } void NetScope::evaluate_parameter_(Design*des, param_ref_t cur) diff --git a/net_event.cc b/net_event.cc index fe1ce3455..ae2dd3ec8 100644 --- a/net_event.cc +++ b/net_event.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 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 @@ -38,6 +38,7 @@ NetEvent::NetEvent(perm_string n) waitref_ = 0; exprref_ = 0; wlist_ = 0; + nb_trig_ = 0; } NetEvent::~NetEvent() diff --git a/net_link.cc b/net_link.cc index 05f1635fd..1f782bd8b 100644 --- a/net_link.cc +++ b/net_link.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 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 @@ -33,7 +33,7 @@ using namespace std; void Nexus::connect(Link&r) { - Nexus*r_nexus = r.next_? r.find_nexus_() : 0; + Nexus*r_nexus = r.next_? r.find_nexus_() : NULL; if (this == r_nexus) return; diff --git a/netclass.cc b/netclass.cc index 99ad5d68a..e9b5e7480 100644 --- a/netclass.cc +++ b/netclass.cc @@ -24,7 +24,7 @@ using namespace std; netclass_t::netclass_t(perm_string name, const netclass_t*super) -: name_(name), super_(super), class_scope_(0), definition_scope_(0) +: name_(name), super_(super), class_scope_(0), definition_scope_(0), virtual_class_(false) { } diff --git a/netlist.h b/netlist.h index 45cb82ee8..cf180df72 100644 --- a/netlist.h +++ b/netlist.h @@ -1,7 +1,7 @@ #ifndef IVL_netlist_H #define IVL_netlist_H /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -4061,7 +4061,7 @@ class NetProcTop : public LineInfo, public Attrib { private: bool tie_off_floating_inputs_(Design*des, NexusSet&nex_map, NetBus&nex_in, - std::vector&bitmasks, + const std::vector&bitmasks, bool is_ff_input); const ivl_process_type_t type_; diff --git a/netstruct.cc b/netstruct.cc index 011a6540b..8d465c082 100644 --- a/netstruct.cc +++ b/netstruct.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2022 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 @@ -27,7 +27,7 @@ using namespace std; netstruct_t::netstruct_t() -: union_(false), packed_(false) +: union_(false), packed_(false), signed_(false) { } diff --git a/netvector.h b/netvector.h index 1bf919cec..97778d5d0 100644 --- a/netvector.h +++ b/netvector.h @@ -98,7 +98,7 @@ class netvector_t : public ivl_type_s { inline netvector_t::netvector_t(const std::vector&pd, ivl_variable_type_t type) -: packed_dims_(pd), type_(type), signed_(false), isint_(false) +: packed_dims_(pd), type_(type), signed_(false), isint_(false), implicit_(false) { } diff --git a/pform.cc b/pform.cc index 8cd13a4e1..a03b1209d 100644 --- a/pform.cc +++ b/pform.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -1900,14 +1900,13 @@ void pform_make_udp(const struct vlltype&loc, perm_string name, perm_string port_name = (*decl)[idx]->basename(); if (PWire*cur = defs[port_name]) { - bool rc = true; assert((*decl)[idx]); if ((*decl)[idx]->get_port_type() != NetNet::PIMPLICIT) { - rc = cur->set_port_type((*decl)[idx]->get_port_type()); + bool rc = cur->set_port_type((*decl)[idx]->get_port_type()); assert(rc); } if ((*decl)[idx]->get_wire_type() != NetNet::IMPLICIT) { - rc = cur->set_wire_type((*decl)[idx]->get_wire_type()); + bool rc = cur->set_wire_type((*decl)[idx]->get_wire_type()); assert(rc); } @@ -2770,7 +2769,7 @@ vector*pform_make_task_ports(const struct vlltype&loc, for (list::iterator cur = ports->begin(); cur != ports->end(); ++cur) { - perm_string &name = cur->name; + const perm_string &name = cur->name; PWire*curw = pform_get_or_make_wire(loc, name, NetNet::IMPLICIT_REG, pt, rt); @@ -2919,7 +2918,7 @@ LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag, } static void pform_set_type_parameter(const struct vlltype&loc, perm_string name, - LexicalScope::range_t*value_range) + const LexicalScope::range_t*value_range) { pform_requires_sv(loc, "Type parameter"); diff --git a/synth2.cc b/synth2.cc index c90d739f2..403baf842 100644 --- a/synth2.cc +++ b/synth2.cc @@ -192,7 +192,7 @@ static void merge_sequential_enables(Design*des, NetScope*scope, } } -static void merge_sequential_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_mask) +static void merge_sequential_masks(NetProc::mask_t&top_mask, const NetProc::mask_t&sub_mask) { if (sub_mask.size() == 0) return; @@ -209,7 +209,7 @@ static void merge_sequential_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub } } -static void merge_parallel_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_mask) +static void merge_parallel_masks(NetProc::mask_t&top_mask, const NetProc::mask_t&sub_mask) { if (sub_mask.size() == 0) return; @@ -226,7 +226,7 @@ static void merge_parallel_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_m } } -static bool all_bits_driven(NetProc::mask_t&mask) +static bool all_bits_driven(const NetProc::mask_t&mask) { if (mask.size() == 0) return false; @@ -240,7 +240,7 @@ static bool all_bits_driven(NetProc::mask_t&mask) bool NetProcTop::tie_off_floating_inputs_(Design*des, NexusSet&nex_map, NetBus&nex_in, - vector&bitmasks, + const vector&bitmasks, bool is_ff_input) { bool flag = true; @@ -1380,8 +1380,8 @@ bool NetCondit::synth_async(Design*des, NetScope*scope, delete bpv; } else { // The part selects are of no use. Forget them. - apv = 0; - bpv = 0; + if (apv) delete apv; + if (bpv) delete bpv; } NetMux*mux = new NetMux(scope, scope->local_symbol(), diff --git a/t-dll.cc b/t-dll.cc index e81f74e68..b009f14f8 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -261,16 +261,16 @@ ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur) for (unsigned idx = 0; idx < des.roots.size(); idx += 1) { assert(des.roots[idx]); - ivl_scope_t scope = find_scope_from_root(des.roots[idx], cur); - if (scope) - return scope; + ivl_scope_t scop = find_scope_from_root(des.roots[idx], cur); + if (scop) + return scop; } for (size_t idx = 0; idx < des.packages.size(); idx += 1) { assert(des.packages[idx]); - ivl_scope_t scope = find_scope_from_root(des.packages[idx], cur); - if (scope) - return scope; + ivl_scope_t scop = find_scope_from_root(des.packages[idx], cur); + if (scop) + return scop; } return 0; @@ -287,14 +287,14 @@ ivl_scope_t dll_target::lookup_scope_(const NetScope*cur) */ ivl_signal_t dll_target::find_signal(ivl_design_s &des, const NetNet*net) { - ivl_scope_t scope = find_scope(des, net->scope()); - assert(scope); + ivl_scope_t scop = find_scope(des, net->scope()); + assert(scop); perm_string nname = net->name(); - for (unsigned idx = 0 ; idx < scope->sigs_.size() ; idx += 1) { - if (strcmp(scope->sigs_[idx]->name_, nname) == 0) - return scope->sigs_[idx]; + for (unsigned idx = 0 ; idx < scop->sigs_.size() ; idx += 1) { + if (strcmp(scop->sigs_[idx]->name_, nname) == 0) + return scop->sigs_[idx]; } assert(0); @@ -2744,7 +2744,7 @@ void dll_target::signal(const NetNet*net) for (unsigned idx = 0 ; idx < obj->array_words ; idx += 1) { - const Nexus*nex = net->pins_are_virtual() ? 0 : net->pin(idx).nexus(); + const Nexus*nex = net->pins_are_virtual() ? NULL : net->pin(idx).nexus(); if (nex == 0) { // Special case: This pin is connected to // nothing. This can happen, for example, if the diff --git a/tgt-blif/blif.cc b/tgt-blif/blif.cc index 59803fccb..5b7016438 100644 --- a/tgt-blif/blif.cc +++ b/tgt-blif/blif.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2013-2022 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 @@ -222,7 +222,7 @@ static void emit_blif(const char*blif_path, ivl_design_t des, ivl_scope_t model) fclose(fd); } -bool scope_is_in_model(ivl_scope_t model, ivl_scope_t scope) +bool scope_is_in_model(const ivl_scope_t model, ivl_scope_t scope) { while (scope) { if (scope==model) diff --git a/tgt-vlog95/logic_lpm.c b/tgt-vlog95/logic_lpm.c index 24dfdc146..6f86d2d42 100644 --- a/tgt-vlog95/logic_lpm.c +++ b/tgt-vlog95/logic_lpm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -345,7 +345,7 @@ static void emit_driver_delay(ivl_scope_t scope, ivl_nexus_t nex) emit_delay(scope, rise, fall, decay, 3); } -static unsigned is_local_nexus(ivl_scope_t scope, ivl_nexus_t nex) +static unsigned is_local_nexus(const ivl_scope_t scope, ivl_nexus_t nex) { unsigned idx, count = ivl_nexus_ptrs(nex); unsigned is_local = 1; @@ -469,7 +469,7 @@ static void emit_nexus_port_signal(ivl_scope_t scope, ivl_nexus_t nex) else fprintf(vlog_out, "/* Empty */"); } -static ivl_signal_t find_local_signal(ivl_scope_t scope, ivl_nexus_t nex, +static ivl_signal_t find_local_signal(const ivl_scope_t scope, ivl_nexus_t nex, unsigned *word) { unsigned idx, count = ivl_nexus_ptrs(nex); @@ -817,7 +817,7 @@ static void emit_lpm_concat(ivl_scope_t scope, ivl_lpm_t lpm) /* * Look for an output signal in the nexus that is driving into this scope. */ -static ivl_signal_t find_output_signal(ivl_scope_t scope, ivl_nexus_t nex, +static ivl_signal_t find_output_signal(const ivl_scope_t scope, ivl_nexus_t nex, unsigned*array_word) { unsigned idx, count = ivl_nexus_ptrs(nex); @@ -961,9 +961,8 @@ static void emit_lpm_part_select(ivl_scope_t scope, ivl_lpm_t lpm, return; } - if (sign_extend) fprintf(vlog_out, "("); - if (sign_extend) { + fprintf(vlog_out, "("); assert(base != lsb); // HERE: This looks wrong. if (msb >= lsb) base += lsb; @@ -1771,7 +1770,7 @@ static void emit_lpm_latch(ivl_scope_t scope, ivl_lpm_t lpm) need_latch_prim = 1; } -static ivl_signal_t get_output_from_nexus(ivl_scope_t scope, ivl_nexus_t nex, +static ivl_signal_t get_output_from_nexus(const ivl_scope_t scope, ivl_nexus_t nex, int64_t*array_idx) { ivl_signal_t use_sig = 0; @@ -1858,8 +1857,8 @@ static void emit_lpm_part_pv(ivl_scope_t scope, ivl_lpm_t lpm) fprintf(vlog_out, "]"); } -static unsigned output_is_module_instantiation_input(ivl_scope_t scope, - ivl_nexus_t nex) +static unsigned output_is_module_instantiation_input(const ivl_scope_t scope, + ivl_nexus_t nex) { unsigned idx, count = ivl_nexus_ptrs(nex); unsigned rtn = 0; diff --git a/tgt-vlog95/misc.c b/tgt-vlog95/misc.c index 57be52a78..8c2b8c2c8 100644 --- a/tgt-vlog95/misc.c +++ b/tgt-vlog95/misc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2020 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -420,7 +420,7 @@ void emit_scaled_expr(ivl_scope_t scope, ivl_expr_t expr, int msb, int lsb) } } -static unsigned find_signal_in_nexus(ivl_scope_t scope, ivl_nexus_t nex) +static unsigned find_signal_in_nexus(const ivl_scope_t scope, ivl_nexus_t nex) { ivl_signal_t use_sig = 0; unsigned is_driver = 0; diff --git a/tgt-vlog95/scope.c b/tgt-vlog95/scope.c index 81177cd83..899052117 100644 --- a/tgt-vlog95/scope.c +++ b/tgt-vlog95/scope.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2021 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2010-2022 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,7 +171,7 @@ static unsigned emit_and_free_net_const_list(ivl_scope_t scope) return idx; } -static void save_net_constants(ivl_scope_t scope, ivl_signal_t sig) +static void save_net_constants(const ivl_scope_t scope, ivl_signal_t sig) { ivl_nexus_t nex = ivl_signal_nex(sig, 0); unsigned idx, count = ivl_nexus_ptrs(nex); @@ -397,7 +397,7 @@ static void emit_module_ports(ivl_scope_t scope) fprintf(vlog_out, ")"); } -static ivl_signal_t get_port_from_nexus(ivl_scope_t scope, ivl_nexus_t nex, +static ivl_signal_t get_port_from_nexus(const ivl_scope_t scope, ivl_nexus_t nex, unsigned *word) { assert(nex); @@ -1015,7 +1015,7 @@ static ivl_scope_t *scopes_to_emit = 0; static unsigned num_scopes_to_emit = 0; static unsigned emitting_scopes = 0; -int emit_scope(ivl_scope_t scope, ivl_scope_t parent) +int emit_scope(ivl_scope_t scope, const ivl_scope_t parent) { char *package_name = 0; ivl_scope_type_t sc_type = ivl_scope_type(scope); diff --git a/tgt-vlog95/stmt.c b/tgt-vlog95/stmt.c index 1a14771df..f94733305 100644 --- a/tgt-vlog95/stmt.c +++ b/tgt-vlog95/stmt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1085,7 +1085,7 @@ static void emit_stmt_delayx(ivl_scope_t scope, ivl_statement_t stmt) emit_stmt(scope, ivl_stmt_sub_stmt(stmt)); } -static unsigned is_func_disable(ivl_scope_t scope, ivl_scope_t disable_scope) +static unsigned is_func_disable(ivl_scope_t scope, const ivl_scope_t disable_scope) { assert(func_rtn_name); /* Find the enclosing function scope. */ diff --git a/tgt-vvp/draw_net_input.c b/tgt-vvp/draw_net_input.c index 45e753b06..53f94f908 100644 --- a/tgt-vvp/draw_net_input.c +++ b/tgt-vvp/draw_net_input.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 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 @@ -280,7 +280,7 @@ static char* draw_net_pull(ivl_net_logic_t lptr, ivl_drive_t drive, const char*l * to this nexus. */ -static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) +static char* draw_net_input_drive(const ivl_nexus_t nex, ivl_nexus_ptr_t nptr) { unsigned nptr_pin = ivl_nexus_ptr_pin(nptr); ivl_net_const_t cptr; @@ -817,7 +817,7 @@ const char*draw_net_input(ivl_nexus_t nex) return nex_data->net_input; } -const char*draw_island_net_input(ivl_island_t island, ivl_nexus_t nex) +const char*draw_island_net_input(const ivl_island_t island, ivl_nexus_t nex) { struct vvp_nexus_data*nex_data = (struct vvp_nexus_data*) ivl_nexus_get_private(nex); diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 5ef76a200..e8e4e4ec5 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -262,7 +262,7 @@ const char*drive_string(ivl_drive_t drive) * to netlist signals. This routine performs this check on the * given nexus. */ -static unsigned is_netlist_signal(ivl_net_logic_t net, ivl_nexus_t nex) +static unsigned is_netlist_signal(const ivl_net_logic_t net, ivl_nexus_t nex) { unsigned idx, rtn; diff --git a/vpi/cppcheck.sup b/vpi/cppcheck.sup index 3990c3cb1..63f17c522 100644 --- a/vpi/cppcheck.sup +++ b/vpi/cppcheck.sup @@ -3,177 +3,184 @@ // problems will not be fixed. // fstapi.c from GTKWave -asctimeCalled:fstapi.c:955 -allocaCalled:fstapi.c:2386 -unreadVariable:fstapi.c:204 -unreadVariable:fstapi.c:205 -unreadVariable:fstapi.c:1645 -unreadVariable:fstapi.c:1653 -unreadVariable:fstapi.c:1657 -unreadVariable:fstapi.c:1662 -unreadVariable:fstapi.c:1685 -unreadVariable:fstapi.c:1691 -unreadVariable:fstapi.c:1692 -unreadVariable:fstapi.c:1696 -unreadVariable:fstapi.c:2818 -unreadVariable:fstapi.c:6521 -variableScope:fstapi.c:684 -variableScope:fstapi.c:1078 -variableScope:fstapi.c:1385 -variableScope:fstapi.c:1386 -variableScope:fstapi.c:1387 -variableScope:fstapi.c:1444 -variableScope:fstapi.c:2056 -variableScope:fstapi.c:2189 -variableScope:fstapi.c:2622 -variableScope:fstapi.c:2623 -variableScope:fstapi.c:2812 -variableScope:fstapi.c:2813 -variableScope:fstapi.c:2814 -variableScope:fstapi.c:2815 -variableScope:fstapi.c:2816 -variableScope:fstapi.c:2817 -variableScope:fstapi.c:2818 -variableScope:fstapi.c:2919 -variableScope:fstapi.c:2920 -variableScope:fstapi.c:2924 -variableScope:fstapi.c:3161 -variableScope:fstapi.c:3200 -variableScope:fstapi.c:3201 -variableScope:fstapi.c:3920 -variableScope:fstapi.c:4098 -variableScope:fstapi.c:4100 -variableScope:fstapi.c:4542 -variableScope:fstapi.c:4543 -variableScope:fstapi.c:4552 -variableScope:fstapi.c:4815 -variableScope:fstapi.c:5086 -variableScope:fstapi.c:5089 -variableScope:fstapi.c:5585 -variableScope:fstapi.c:5589 -variableScope:fstapi.c:5590 -variableScope:fstapi.c:5748 -variableScope:fstapi.c:5806 -variableScope:fstapi.c:6119 -variableScope:fstapi.c:6122 -variableScope:fstapi.c:6416 -variableScope:fstapi.c:6521 -variableScope:fstapi.c:6522 -variableScope:fstapi.c:6553 -variableScope:fstapi.c:6781 -variableScope:fstapi.c:6957 -variableScope:fstapi.c:6958 -variableScope:fstapi.c:6959 +asctimeCalled:fstapi.c:965 +allocaCalled:fstapi.c:2396 +unreadVariable:fstapi.c:214 +unreadVariable:fstapi.c:215 +unreadVariable:fstapi.c:1655 +unreadVariable:fstapi.c:1663 +unreadVariable:fstapi.c:1667 +unreadVariable:fstapi.c:1672 +unreadVariable:fstapi.c:1695 +unreadVariable:fstapi.c:1701 +unreadVariable:fstapi.c:1702 +unreadVariable:fstapi.c:1706 +unreadVariable:fstapi.c:2828 +unreadVariable:fstapi.c:6555 +variableScope:fstapi.c:694 +variableScope:fstapi.c:1088 +variableScope:fstapi.c:1395 +variableScope:fstapi.c:1396 +variableScope:fstapi.c:1397 +variableScope:fstapi.c:1454 +variableScope:fstapi.c:1944 +variableScope:fstapi.c:2064 +variableScope:fstapi.c:2066 +variableScope:fstapi.c:2187 +variableScope:fstapi.c:2199 +variableScope:fstapi.c:2632 +variableScope:fstapi.c:2633 +variableScope:fstapi.c:2822 +variableScope:fstapi.c:2823 +variableScope:fstapi.c:2824 +variableScope:fstapi.c:2825 +variableScope:fstapi.c:2826 +variableScope:fstapi.c:2827 +variableScope:fstapi.c:2828 +variableScope:fstapi.c:2929 +variableScope:fstapi.c:2930 +variableScope:fstapi.c:2934 +variableScope:fstapi.c:3171 +variableScope:fstapi.c:3210 +variableScope:fstapi.c:3211 +variableScope:fstapi.c:3927 +variableScope:fstapi.c:3930 +variableScope:fstapi.c:4108 +variableScope:fstapi.c:4110 +variableScope:fstapi.c:4578 +variableScope:fstapi.c:4579 +variableScope:fstapi.c:4582 +variableScope:fstapi.c:4583 +variableScope:fstapi.c:4591 +variableScope:fstapi.c:4592 +variableScope:fstapi.c:4854 +variableScope:fstapi.c:5120 +variableScope:fstapi.c:5123 +variableScope:fstapi.c:5619 +variableScope:fstapi.c:5623 +variableScope:fstapi.c:5624 +variableScope:fstapi.c:5782 +variableScope:fstapi.c:5840 +variableScope:fstapi.c:6153 +variableScope:fstapi.c:6156 +variableScope:fstapi.c:6450 +variableScope:fstapi.c:6555 +variableScope:fstapi.c:6556 +variableScope:fstapi.c:6587 +variableScope:fstapi.c:6815 +variableScope:fstapi.c:6991 +variableScope:fstapi.c:6992 +variableScope:fstapi.c:6993 // These functions are not used by Icarus // fstReaderClrFacProcessMask() -unusedFunction:fstapi.c:3652 +unusedFunction:fstapi.c:3662 // fstReaderClrFacProcessMaskAll() -unusedFunction:fstapi.c:3681 +unusedFunction:fstapi.c:3691 // fstReaderGetAliasCount() -unusedFunction:fstapi.c:3744 +unusedFunction:fstapi.c:3754 // fstReaderGetCurrentFlatScope() -unusedFunction:fstapi.c:3490 +unusedFunction:fstapi.c:3500 // fstReaderGetCurrentScopeLen() -unusedFunction:fstapi.c:3587 +unusedFunction:fstapi.c:3597 // fstReaderGetCurrentScopeUserInfo() -unusedFunction:fstapi.c:3504 +unusedFunction:fstapi.c:3514 // fstReaderGetDateString() -unusedFunction:fstapi.c:3772 +unusedFunction:fstapi.c:3782 // fstReaderGetDoubleEndianMatchState() -unusedFunction:fstapi.c:3758 +unusedFunction:fstapi.c:3768 // fstReaderGetDumpActivityChangeTime() -unusedFunction:fstapi.c:3800 +unusedFunction:fstapi.c:3810 // fstReaderGetDumpActivityChangeValue() -unusedFunction:fstapi.c:3815 +unusedFunction:fstapi.c:3825 // fstReaderGetEndTime() -unusedFunction:fstapi.c:3709 +unusedFunction:fstapi.c:3719 // fstReaderGetFacProcessMask() -unusedFunction:fstapi.c:3615 +unusedFunction:fstapi.c:3625 // fstReaderGetFileType() -unusedFunction:fstapi.c:3779 +unusedFunction:fstapi.c:3789 // fstReaderGetFseekFailed() -unusedFunction:fstapi.c:3600 +unusedFunction:fstapi.c:3610 // fstReaderGetMaxHandle() -unusedFunction:fstapi.c:3737 +unusedFunction:fstapi.c:3747 // fstReaderGetMemoryUsedByWriter() -unusedFunction:fstapi.c:3716 +unusedFunction:fstapi.c:3726 // fstReaderGetNumberDumpActivityChanges() -unusedFunction:fstapi.c:3793 +unusedFunction:fstapi.c:3803 // fstReaderGetScopeCount() -unusedFunction:fstapi.c:3723 +unusedFunction:fstapi.c:3733 // fstReaderGetStartTime() -unusedFunction:fstapi.c:3702 +unusedFunction:fstapi.c:3712 // fstReaderGetTimescale() -unusedFunction:fstapi.c:3695 +unusedFunction:fstapi.c:3705 // fstReaderGetTimezero() -unusedFunction:fstapi.c:3786 +unusedFunction:fstapi.c:3796 // fstReaderGetValueChangeSectionCount() -unusedFunction:fstapi.c:3751 +unusedFunction:fstapi.c:3761 // fstReaderGetValueFromHandleAtTime() -unusedFunction:fstapi.c:6001 +unusedFunction:fstapi.c:6035 // fstReaderGetVarCount() -unusedFunction:fstapi.c:3730 +unusedFunction:fstapi.c:3740 // fstReaderGetVersionString() -unusedFunction:fstapi.c:3765 +unusedFunction:fstapi.c:3775 // fstReaderIterBlocks() -unusedFunction:fstapi.c:4964 +unusedFunction:fstapi.c:5003 // fstReaderIterBlocksSetNativeDoublesOnCallback() -unusedFunction:fstapi.c:3865 +unusedFunction:fstapi.c:3875 // fstReaderIterateHier() -unusedFunction:fstapi.c:4094 +unusedFunction:fstapi.c:4104 // fstReaderIterateHierRewind() -unusedFunction:fstapi.c:4074 +unusedFunction:fstapi.c:4084 // fstReaderOpen() -unusedFunction:fstapi.c:4862 +unusedFunction:fstapi.c:4901 // fstReaderOpenForUtilitiesOnly() -unusedFunction:fstapi.c:4854 +unusedFunction:fstapi.c:4893 // fstReaderPushScope() -unusedFunction:fstapi.c:3552 +unusedFunction:fstapi.c:3562 // fstReaderResetScope() -unusedFunction:fstapi.c:3541 +unusedFunction:fstapi.c:3551 // fstReaderSetFacProcessMask() -unusedFunction:fstapi.c:3634 +unusedFunction:fstapi.c:3644 // fstReaderSetFacProcessMaskAll() -unusedFunction:fstapi.c:3670 +unusedFunction:fstapi.c:3680 // fstReaderSetLimitTimeRange() -unusedFunction:fstapi.c:3830 +unusedFunction:fstapi.c:3840 // fstReaderSetUnlimitedTimeRange() -unusedFunction:fstapi.c:3843 +unusedFunction:fstapi.c:3853 // fstReaderSetVcdExtensions() -unusedFunction:fstapi.c:3854 +unusedFunction:fstapi.c:3864 // fstUtilityExtractEnumTableFromString() -unusedFunction:fstapi.c:6954 +unusedFunction:fstapi.c:6988 // fstUtilityFreeEnumTable() -unusedFunction:fstapi.c:7015 +unusedFunction:fstapi.c:7049 // fstWriterCreateEnumTable() -unusedFunction:fstapi.c:2807 +unusedFunction:fstapi.c:2817 // fstWriterCreateVar2() -unusedFunction:fstapi.c:2609 +unusedFunction:fstapi.c:2619 // fstWriterEmitEnumTableRef() -unusedFunction:fstapi.c:2902 +unusedFunction:fstapi.c:2912 // fstWriterEmitValueChangeVec32() -unusedFunction:fstapi.c:3054 +unusedFunction:fstapi.c:3064 // fstWriterEmitValueChangeVec64() -unusedFunction:fstapi.c:3103 +unusedFunction:fstapi.c:3113 // fstWriterEmitVariableLengthValueChange() -unusedFunction:fstapi.c:3154 +unusedFunction:fstapi.c:3164 // fstWriterGetFseekFailed() -unusedFunction:fstapi.c:2592 +unusedFunction:fstapi.c:2602 // fstWriterSetAttrEnd() -unusedFunction:fstapi.c:2795 +unusedFunction:fstapi.c:2805 // fstWriterSetComment() -unusedFunction:fstapi.c:2441 +unusedFunction:fstapi.c:2451 // fstWriterSetEnvVar() -unusedFunction:fstapi.c:2453 +unusedFunction:fstapi.c:2463 // fstWriterSetFileType() -unusedFunction:fstapi.c:2316 +unusedFunction:fstapi.c:2326 // fstWriterSetParallelMode() -unusedFunction:fstapi.c:2552 +unusedFunction:fstapi.c:2562 // fstWriterSetTimezero() -unusedFunction:fstapi.c:2517 +unusedFunction:fstapi.c:2527 // fstWriterSetValueList() -unusedFunction:fstapi.c:2447 +unusedFunction:fstapi.c:2457 // lxt2_write.c from GTKWave allocaCalled:lxt2_write.c:1813 @@ -335,7 +342,7 @@ unusedFunction:lz4.c:376 // The routines in sys_random.c are exact copies from IEEE1364-2005 and // they have scope warnings that we need to ignore. -variableScope:sys_random.c:46 -variableScope:sys_random.c:69 -variableScope:sys_random.c:92 -variableScope:sys_random.c:147 +variableScope:sys_random.c:47 +variableScope:sys_random.c:70 +variableScope:sys_random.c:93 +variableScope:sys_random.c:148 diff --git a/vpi/mt19937int.c b/vpi/mt19937int.c index ac6fe01e0..73eaad068 100644 --- a/vpi/mt19937int.c +++ b/vpi/mt19937int.c @@ -1,5 +1,5 @@ /* - * NOTE: This code as been slightly modified to interface with the + * NOTE: This code has been slightly modified to interface with the * PLI implementations of $random. The copyright and license * information are given in the comment block below. * @@ -89,7 +89,7 @@ genrand(struct context_s *context) if (mti >= N) { /* generate N words at one time */ /* mag01[x] = x * MATRIX_A for x=0,1 */ - static unsigned long mag01[2]={0x0, MATRIX_A}; + static const unsigned long mag01[2]={0x0, MATRIX_A}; int kk; if (mti == N+1) /* if sgenrand() has not been called, */ diff --git a/vvp/array.cc b/vvp/array.cc index 4727a4ebf..bb8b539fc 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -334,7 +334,7 @@ int __vpiArrayWord::as_word_t::vpi_get(int code) { struct __vpiArrayWord*obj = array_var_word_from_handle(this); assert(obj); - struct __vpiArrayBase*parent = obj->get_parent(); + struct __vpiArrayBase*my_parent = obj->get_parent(); t_vpi_value val; switch (code) { @@ -342,24 +342,24 @@ int __vpiArrayWord::as_word_t::vpi_get(int code) return 0; // Not implemented for now! case vpiSize: - return parent->get_word_size(); + return my_parent->get_word_size(); case vpiLeftRange: val.format = vpiIntVal; - parent->get_left_range()->vpi_get_value(&val); + my_parent->get_left_range()->vpi_get_value(&val); assert(val.format == vpiIntVal); return val.value.integer; case vpiRightRange: val.format = vpiIntVal; - parent->get_right_range()->vpi_get_value(&val); + my_parent->get_right_range()->vpi_get_value(&val); assert(val.format == vpiIntVal); return val.value.integer; case vpiIndex: { int base_offset = 0; - struct __vpiArray*base = dynamic_cast<__vpiArray*> (parent); + struct __vpiArray*base = dynamic_cast<__vpiArray*> (my_parent); if (base) { val.format = vpiIntVal; base->first_addr.vpi_get_value(&val); @@ -372,7 +372,7 @@ int __vpiArrayWord::as_word_t::vpi_get(int code) } case vpiAutomatic: - return parent->get_scope()->is_automatic()? 1 : 0; + return my_parent->get_scope()->is_automatic()? 1 : 0; #if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX) case _vpiFromThr: diff --git a/vvp/array_common.cc b/vvp/array_common.cc index 59d928df9..2fefbf1c1 100644 --- a/vvp/array_common.cc +++ b/vvp/array_common.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2014-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 2014 CERN * @author Maciej Suminski * @@ -116,24 +116,24 @@ char* __vpiArrayWord::as_word_t::vpi_get_str(int code) { struct __vpiArrayWord*obj = array_var_word_from_handle(this); assert(obj); - struct __vpiArrayBase*parent = obj->get_parent(); - return parent->get_word_str(obj, code); + struct __vpiArrayBase*my_parent = obj->get_parent(); + return my_parent->get_word_str(obj, code); } void __vpiArrayWord::as_word_t::vpi_get_value(p_vpi_value vp) { struct __vpiArrayWord*obj = array_var_word_from_handle(this); assert(obj); - struct __vpiArrayBase*parent = obj->get_parent(); - return parent->get_word_value(obj, vp); + struct __vpiArrayBase*my_parent = obj->get_parent(); + return my_parent->get_word_value(obj, vp); } vpiHandle __vpiArrayWord::as_word_t::vpi_put_value(p_vpi_value vp, int flags) { struct __vpiArrayWord*obj = array_var_word_from_handle(this); assert(obj); - struct __vpiArrayBase*parent = obj->get_parent(); - parent->put_word_value(obj, vp, flags); + struct __vpiArrayBase*my_parent = obj->get_parent(); + my_parent->put_word_value(obj, vp, flags); return this; } @@ -141,7 +141,7 @@ vpiHandle __vpiArrayWord::as_word_t::vpi_handle(int code) { struct __vpiArrayWord*obj = array_var_word_from_handle(this); assert(obj); - struct __vpiArrayBase*parent = obj->get_parent(); + struct __vpiArrayBase*my_parent = obj->get_parent(); switch (code) { @@ -149,19 +149,19 @@ vpiHandle __vpiArrayWord::as_word_t::vpi_handle(int code) return &(obj->as_index); case vpiLeftRange: - return parent->get_left_range(); + return my_parent->get_left_range(); case vpiRightRange: - return parent->get_right_range(); + return my_parent->get_right_range(); case vpiParent: - return dynamic_cast(parent); + return dynamic_cast(my_parent); case vpiScope: - return parent->get_scope(); + return my_parent->get_scope(); case vpiModule: - return vpip_module(parent->get_scope()); + return vpip_module(my_parent->get_scope()); } return 0; diff --git a/vvp/cppcheck.sup b/vvp/cppcheck.sup index 1d0fe930b..a3135f088 100644 --- a/vvp/cppcheck.sup +++ b/vvp/cppcheck.sup @@ -1,6 +1,6 @@ // The new() operator is always used to allocate space for this class and // pool is defined there. -uninitMemberVar:vvp_net.cc:190 +uninitMemberVar:vvp_net.cc:192 // These functions are not used by Icarus // vpi_chk_error() diff --git a/vvp/island_tran.cc b/vvp/island_tran.cc index cdb3946a6..b5282c424 100644 --- a/vvp/island_tran.cc +++ b/vvp/island_tran.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2008-2022 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 @@ -185,7 +185,7 @@ void vvp_island_tran::count_drivers(vvp_island_port*port, unsigned bit_idx, void vvp_island_branch_tran::run_test_enabled() { - vvp_island_port*ep = en? dynamic_cast (en->fun) : 0; + vvp_island_port*ep = en? dynamic_cast (en->fun) : NULL; // If there is no ep port (no "enabled" input) then this is a // tran branch. Assume it is always enabled. diff --git a/vvp/parse.y b/vvp/parse.y index 5ac94bdf5..1224fa21a 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -1,7 +1,7 @@ %{ /* - * Copyright (c) 2001-202` Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 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 diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index dfd9d4d8c..80a640186 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 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 @@ -461,7 +461,7 @@ static struct __vpiCallback* make_at_end_of_sim_time(p_cb_data data) class simulator_callback : public __vpiCallback { public: - inline explicit simulator_callback(struct t_cb_data*data) + inline explicit simulator_callback(const struct t_cb_data*data) { cb_data = *data; } public: diff --git a/vvp/vpi_cobject.cc b/vvp/vpi_cobject.cc index 4bcee73d5..d0343e3d2 100644 --- a/vvp/vpi_cobject.cc +++ b/vvp/vpi_cobject.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 Picture Elements, Inc. + * Copyright (c) 2012-2022 Picture Elements, Inc. * Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -117,7 +117,7 @@ void __vpiCobjectVar::vpi_get_value(p_vpi_value val) vpiHandle vpip_make_cobject_var(const char*name, vvp_net_t*net) { __vpiScope*scope = vpip_peek_current_scope(); - const char*use_name = name ? vpip_name_string(name) : 0; + const char*use_name = name ? vpip_name_string(name) : NULL; __vpiCobjectVar*obj = new __vpiCobjectVar(scope, use_name, net); diff --git a/vvp/vpi_darray.cc b/vvp/vpi_darray.cc index bc63ff741..6edde31d0 100644 --- a/vvp/vpi_darray.cc +++ b/vvp/vpi_darray.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2022 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 @@ -286,7 +286,7 @@ vvp_darray*__vpiDarrayVar::get_vvp_darray() const vpiHandle vpip_make_darray_var(const char*name, vvp_net_t*net) { __vpiScope*scope = vpip_peek_current_scope(); - const char*use_name = name ? vpip_name_string(name) : 0; + const char*use_name = name ? vpip_name_string(name) : NULL; __vpiDarrayVar*obj = new __vpiDarrayVar(scope, use_name, net); @@ -332,7 +332,7 @@ void __vpiQueueVar::vpi_get_value(p_vpi_value val) vpiHandle vpip_make_queue_var(const char*name, vvp_net_t*net) { __vpiScope*scope = vpip_peek_current_scope(); - const char*use_name = name ? vpip_name_string(name) : 0; + const char*use_name = name ? vpip_name_string(name) : NULL; __vpiQueueVar*obj = new __vpiQueueVar(scope, use_name, net); diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 99cc8a20c..ff11cfe9e 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2008-2022 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 @@ -1057,7 +1057,7 @@ void vpip_put_value_event::run_run() } /* Make a copy of a pointer to a time structure. */ -static t_vpi_time *timedup(t_vpi_time *val) +static t_vpi_time *timedup(const t_vpi_time *val) { t_vpi_time *rtn; rtn = static_cast (malloc(sizeof(t_vpi_time))); @@ -1078,7 +1078,7 @@ static t_vpi_vecval *vectordup(t_vpi_vecval *val, PLI_INT32 size) } /* Make a copy of a pointer to a strength structure. */ -static t_vpi_strengthval *strengthdup(t_vpi_strengthval *val) +static t_vpi_strengthval *strengthdup(const t_vpi_strengthval *val) { t_vpi_strengthval *rtn; rtn = static_cast diff --git a/vvp/vpi_real.cc b/vvp/vpi_real.cc index e51ee3219..23f63c53d 100644 --- a/vvp/vpi_real.cc +++ b/vvp/vpi_real.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2022 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 @@ -86,10 +86,10 @@ static vpiHandle real_var_get_handle(int code, vpiHandle ref) switch (code) { case vpiParent: - return rfp->is_netarray ? rfp->within.parent : 0; + return rfp->is_netarray ? rfp->within.parent : NULL; case vpiIndex: - return rfp->is_netarray ? rfp->id.index : 0; + return rfp->is_netarray ? rfp->id.index : NULL; case vpiScope: return vpip_scope(rfp); @@ -107,7 +107,7 @@ static vpiHandle real_var_iterate(int code, vpiHandle ref) assert(rfp); if (code == vpiIndex) { - return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : 0; + return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : NULL; } return 0; @@ -183,7 +183,7 @@ static vpiHandle vpip_make_real_(__vpiScope*scope, const char*name, { struct __vpiRealVar*obj = new __vpiRealVar; - obj->id.name = name ? vpip_name_string(name) : 0; + obj->id.name = name ? vpip_name_string(name) : NULL; obj->is_netarray = 0; obj->is_wire = is_wire; obj->net = net; diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 7dc30f430..6ed41455f 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 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 @@ -639,10 +639,10 @@ static vpiHandle signal_get_handle(int code, vpiHandle ref) switch (code) { case vpiParent: - return rfp->is_netarray? rfp->within.parent : 0; + return rfp->is_netarray? rfp->within.parent : NULL; case vpiIndex: - return rfp->is_netarray? rfp->id.index : 0; + return rfp->is_netarray? rfp->id.index : NULL; case vpiLeftRange: return &rfp->msb; @@ -665,7 +665,7 @@ static vpiHandle signal_iterate(int code, vpiHandle ref) assert(rfp); if (code == vpiIndex) { - return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : 0; + return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : NULL; } return 0; @@ -1266,7 +1266,7 @@ static vpiHandle fill_in_net4(struct __vpiSignal*obj, __vpiScope*scope, const char*name, int msb, int lsb, bool signed_flag, vvp_net_t*node) { - obj->id.name = name? vpip_name_string(name) : 0; + obj->id.name = name? vpip_name_string(name) : NULL; obj->msb = __vpiDecConst(msb); obj->lsb = __vpiDecConst(lsb); obj->signed_flag = signed_flag? 1 : 0; diff --git a/vvp/vpi_string.cc b/vvp/vpi_string.cc index b0fbe330c..7ae1d95cd 100644 --- a/vvp/vpi_string.cc +++ b/vvp/vpi_string.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2022 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 @@ -92,7 +92,7 @@ vpiHandle __vpiStringVar::vpi_put_value(p_vpi_value val, int) vpiHandle vpip_make_string_var(const char*name, vvp_net_t*net) { __vpiScope*scope = vpip_peek_current_scope(); - const char*use_name = name ? vpip_name_string(name) : 0; + const char*use_name = name ? vpip_name_string(name) : NULL; __vpiStringVar*obj = new __vpiStringVar(scope, use_name, net); diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 93e368619..135b20ea9 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 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 @@ -3204,7 +3204,7 @@ bool of_FLAG_SET_IMM(vthread_t thr, vvp_code_t cp) assert(flag < vthread_s::FLAGS_COUNT); assert(vali >= 0 && vali < 4); - static vvp_bit4_t map_bit[4] = {BIT4_0, BIT4_1, BIT4_Z, BIT4_X}; + static const vvp_bit4_t map_bit[4] = {BIT4_0, BIT4_1, BIT4_Z, BIT4_X}; thr->flags[flag] = map_bit[vali]; return true; } @@ -5162,12 +5162,12 @@ inline void push_value(vthread_t thr, double value, unsigned) thr->push_real(value); } -inline void push_value(vthread_t thr, string value, unsigned) +inline void push_value(vthread_t thr, const string&value, unsigned) { thr->push_str(value); } -inline void push_value(vthread_t thr, vvp_vector4_t value, unsigned wid) +inline void push_value(vthread_t thr, const vvp_vector4_t&value, unsigned wid) { assert(wid == value.size()); thr->push_vec4(value); @@ -5357,7 +5357,7 @@ static void poke_val(vthread_t fun_thr, unsigned depth, double val) fun_thr->parent->poke_real(depth, val); } -static void poke_val(vthread_t fun_thr, unsigned depth, string val) +static void poke_val(vthread_t fun_thr, unsigned depth, const string&val) { fun_thr->parent->poke_str(depth, val); } diff --git a/vvp/vvp_island.cc b/vvp/vvp_island.cc index 3c2de115b..3bc48268f 100644 --- a/vvp/vvp_island.cc +++ b/vvp/vvp_island.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2008-2022 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 @@ -34,7 +34,9 @@ using namespace std; +#ifdef CHECK_WITH_VALGRIND static bool at_EOS = false; +#endif void island_send_value(vvp_net_t*net, const vvp_vector8_t&val) { @@ -61,7 +63,9 @@ vvp_island::vvp_island() vvp_island::~vvp_island() { // We can only delete islands at the end of simulation. +#ifdef CHECK_WITH_VALGRIND if (!at_EOS) assert(0); +#endif while (branches_) { vvp_island_branch *next_br = branches_->next_branch; diff --git a/vvp/words.cc b/vvp/words.cc index 80977b029..c8efb65fb 100644 --- a/vvp/words.cc +++ b/vvp/words.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2022 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 @@ -373,7 +373,7 @@ static void __compile_net(char*label, int vpi_type_code, bool signed_flag, bool local_flag, unsigned argc, struct symb_s*argv) { - vvp_array_t array = array_label? array_find(array_label) : 0; + vvp_array_t array = array_label? array_find(array_label) : NULL; assert(array_label ? array!=0 : true); free(array_label); @@ -503,7 +503,7 @@ static void __compile_real(char*label, char*name, unsigned argc, struct symb_s*argv) { assert(msb == 0 && lsb == 0); - vvp_array_t array = array_label ? array_find(array_label) : 0; + vvp_array_t array = array_label ? array_find(array_label) : NULL; assert(array_label ? array!=0 : true); free(array_label);