More cppcheck cleanup

This commit is contained in:
Cary R 2026-01-05 18:53:31 -08:00
parent e5943047da
commit c172a0d3a7
56 changed files with 710 additions and 527 deletions

View File

@ -1,7 +1,7 @@
#ifndef IVL_AStatement_H
#define IVL_AStatement_H
/*
* Copyright (c) 2008-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2026 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
@ -42,6 +42,9 @@ class AContrib : public Statement {
AContrib(PExpr*lval, PExpr*rval);
~AContrib() override;
AContrib(const AContrib&) = delete;
AContrib& operator=(const AContrib&) = delete;
virtual void dump(std::ostream&out, unsigned ind) const override;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2025 Stephen Williams <steve@icarus.com>
* Copyright (c) 1998-2026 Stephen Williams <steve@icarus.com>
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -385,7 +385,7 @@ static bool find_enum_constant(LexicalScope*scope, perm_string name)
return std::any_of(scope->enum_sets.cbegin(), scope->enum_sets.cend(),
[name](const enum_type_t *cur) {
return std::any_of(cur->names->cbegin(), cur->names->cend(),
[name](const named_pexpr_t idx){return idx.name == name;});
[name](const named_pexpr_t&idx){return idx.name == name;});
});
}

View File

@ -1,7 +1,7 @@
#ifndef IVL_Statement_H
#define IVL_Statement_H
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 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
@ -55,6 +55,9 @@ class PProcess : public LineInfo {
virtual ~PProcess() override;
PProcess(const PProcess&) = delete;
PProcess& operator=(const PProcess&) = delete;
bool elaborate(Design*des, NetScope*scope) const;
ivl_process_type_t type() const { return type_; }
@ -101,6 +104,9 @@ class PAssign_ : public Statement {
explicit PAssign_(PExpr*lval, PExpr*cnt, PEventStatement*de, PExpr*ex);
virtual ~PAssign_() override =0;
PAssign_(const PAssign_&) = delete;
PAssign_& operator=(const PAssign_&) = delete;
const PExpr* lval() const { return lval_; }
PExpr* rval() const { return rval_; }
@ -307,6 +313,9 @@ class PCAssign : public Statement {
explicit PCAssign(PExpr*l, PExpr*r);
~PCAssign() override;
PCAssign(const PCAssign&) = delete;
PCAssign& operator=(const PCAssign&) = delete;
virtual NetCAssign* elaborate(Design*des, NetScope*scope) const override;
virtual void dump(std::ostream&out, unsigned ind) const override;
@ -370,6 +379,9 @@ class PDeassign : public Statement {
explicit PDeassign(PExpr*l);
~PDeassign() override;
PDeassign(const PDeassign&) = delete;
PDeassign& operator=(const PDeassign&) = delete;
virtual NetDeassign* elaborate(Design*des, NetScope*scope) const override;
virtual void dump(std::ostream&out, unsigned ind) const override;
@ -416,6 +428,9 @@ class PDoWhile : public Statement {
PDoWhile(PExpr*ex, Statement*st);
~PDoWhile() override;
PDoWhile(const PDoWhile&) = delete;
PDoWhile& operator=(const PDoWhile&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void elaborate_scope(Design*des, NetScope*scope) const override;
virtual void elaborate_sig(Design*des, NetScope*scope) const override;
@ -479,6 +494,9 @@ class PForce : public Statement {
explicit PForce(PExpr*l, PExpr*r);
~PForce() override;
PForce(const PForce&) = delete;
PForce& operator=(const PForce&) = delete;
virtual NetForce* elaborate(Design*des, NetScope*scope) const override;
virtual void dump(std::ostream&out, unsigned ind) const override;
@ -492,6 +510,9 @@ class PForeach : public Statement {
explicit PForeach(perm_string var, const std::list<perm_string>&ix, Statement*stmt);
~PForeach() override;
PForeach(const PForeach&) = delete;
PForeach& operator=(const PForeach&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void elaborate_scope(Design*des, NetScope*scope) const override;
virtual void elaborate_sig(Design*des, NetScope*scope) const override;
@ -512,6 +533,9 @@ class PForever : public Statement {
explicit PForever(Statement*s);
~PForever() override;
PForever(const PForever&) = delete;
PForever& operator=(const PForever&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void elaborate_scope(Design*des, NetScope*scope) const override;
virtual void elaborate_sig(Design*des, NetScope*scope) const override;
@ -556,6 +580,9 @@ class PRepeat : public Statement {
explicit PRepeat(PExpr*expr, Statement*s);
~PRepeat() override;
PRepeat(const PRepeat&) = delete;
PRepeat& operator=(const PRepeat&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void elaborate_scope(Design*des, NetScope*scope) const override;
virtual void elaborate_sig(Design*des, NetScope*scope) const override;
@ -572,6 +599,9 @@ class PRelease : public Statement {
explicit PRelease(PExpr*l);
~PRelease() override;
PRelease(const PRelease&) = delete;
PRelease& operator=(const PRelease&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void dump(std::ostream&out, unsigned ind) const override;
@ -585,6 +615,9 @@ class PReturn : public Statement {
explicit PReturn(PExpr*e);
~PReturn() override;
PReturn(const PReturn&) = delete;
PReturn& operator=(const PReturn&) = delete;
NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void dump(std::ostream&out, unsigned ind) const override;
@ -630,6 +663,9 @@ class PWhile : public Statement {
PWhile(PExpr*ex, Statement*st);
~PWhile() override;
PWhile(const PWhile&) = delete;
PWhile& operator=(const PWhile&) = delete;
virtual NetProc* elaborate(Design*des, NetScope*scope) const override;
virtual void elaborate_scope(Design*des, NetScope*scope) const override;
virtual void elaborate_sig(Design*des, NetScope*scope) const override;

View File

@ -1,5 +1,3 @@
// For now skip using STL algorithms
useStlAlgorithm
// Skip all messages about missing system include files
missingIncludeSystem
// Skip the active checker report message

View File

@ -1,6 +1,25 @@
// Skip the use STL messages
useStlAlgorithm
// Skip all memory issues since they should be handled by ivl_alloc.h
ctunullpointerOutOfMemory
nullPointerArithmeticOutOfMemory
nullPointerOutOfMemory
// Skip strdup() not constant.
constVariablePointer:main.cc:400
constVariablePointer:main.cc:404
constVariablePointer:main.cc:654
// Skip not initialized in the constructor for target scope
uninitMemberVar:t-dll.cc
// By convention we put statics at the top scope.
variableScope:pform.cc:3461
// These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:5310
thisSubtraction:netlist.h:5319
thisSubtraction:netlist.h:5309
thisSubtraction:netlist.h:5318
// This is used when running a debugger
// debugger_release
@ -647,9 +666,9 @@ unusedFunction:t-dll-api.cc:980
// has_compat_attributes()
unusedFunction:Attrib.cc:72
// bl_type()
unusedFunction:Statement.h:186
unusedFunction:Statement.h:192
// chain_args()
unusedFunction:Statement.h:332
unusedFunction:Statement.h:341
// gn_modules_nest()
unusedFunction:compiler.h:228
// driven_mask()
@ -689,7 +708,7 @@ unusedFunction:t-dll-expr.cc:91
// net_assign()
unusedFunction:t-dll.cc:2368
// is_before()
unusedFunction:verinum.cc:592
unusedFunction:verinum.cc:589
// Errors/limitations in the generated yacc and lex files
constVariablePointer:<stdout>
@ -700,6 +719,11 @@ syntaxError:<stdout>
unusedFunction:<stdout>
duplicateBreak:lexor.lex
allocaCalled:parse.cc
constParameterPointer:parse.cc
constVariablePointer:parse.cc
knownConditionTrueFalse:parse.cc
syntaxError:parse.cc
allocaCalled:syn-rules.cc
constParameterPointer:syn-rules.cc
knownConditionTrueFalse:syn-rules.cc
constVariablePointer:syn-rules.cc

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 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
@ -50,7 +50,7 @@ struct cprop_functor : public functor_t {
virtual void lpm_mux(Design*des, NetMux*obj) override;
virtual void lpm_part_select(Design*des, NetPartSelect*obj) override;
void lpm_compare_eq_(Design*des, const NetCompare*obj);
static void lpm_compare_eq_(Design*des, const NetCompare*obj);
};
void cprop_functor::signal(Design*, NetNet*)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -4972,7 +4972,8 @@ NetExpr* PEIdent::elaborate_expr_(Design*des, NetScope*scope,
const name_component_t member_comp = sr.path_tail.front();
ivl_assert(*this, member_comp.index.empty());
return check_for_enum_methods(this, des, scope,
netenum, sr.path_head,
netenum,
pform_scoped_name_t(sr.path_head),
member_comp.name,
expr, {});
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2026 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
@ -1687,7 +1687,7 @@ NetEConst* NetESFunc::evaluate_clog2_(const NetExpr*arg_) const
return rtn;
}
NetEConst* NetESFunc::evaluate_rtoi_(const NetExpr*arg_) const
NetEConst* NetESFunc::evaluate_rtoi_(const NetExpr*arg_)
{
const NetEConst*tmpi = dynamic_cast<const NetEConst*>(arg_);
const NetECReal*tmpr = dynamic_cast<const NetECReal*>(arg_);
@ -1710,7 +1710,7 @@ NetEConst* NetESFunc::evaluate_rtoi_(const NetExpr*arg_) const
return new NetEConst(verinum(verinum(arg, false), integer_width));
}
NetECReal* NetESFunc::evaluate_itor_(const NetExpr*arg_) const
NetECReal* NetESFunc::evaluate_itor_(const NetExpr*arg_)
{
const NetEConst*tmpi = dynamic_cast<const NetEConst*>(arg_);
const NetECReal*tmpr = dynamic_cast<const NetECReal*>(arg_);
@ -2139,7 +2139,7 @@ NetEConst* NetESFunc::evaluate_onehot0_(const NetExpr* arg) const
}
/* Get the number of unpacked dimensions for the given expression. */
NetEConst* NetESFunc::evaluate_unpacked_dimensions_(const NetExpr*arg) const
NetEConst* NetESFunc::evaluate_unpacked_dimensions_(const NetExpr*arg)
{
const NetESignal*esig = dynamic_cast<const NetESignal*>(arg);
long res = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 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
@ -1731,7 +1731,7 @@ NetLiteral::~NetLiteral()
{
}
ivl_variable_type_t NetLiteral::data_type() const
ivl_variable_type_t NetLiteral::data_type()
{
return IVL_VT_REAL;
}
@ -2593,11 +2593,6 @@ NetEUBits::~NetEUBits()
{
}
ivl_variable_type_t NetEUBits::expr_type() const
{
return expr_->expr_type();
}
NetEUReduce::NetEUReduce(char op__, NetExpr*ex)
: NetEUnary(op__, ex, 1, false)
{
@ -2607,11 +2602,6 @@ NetEUReduce::~NetEUReduce()
{
}
ivl_variable_type_t NetEUReduce::expr_type() const
{
return expr_->expr_type();
}
NetECast::NetECast(char op__, NetExpr*ex, unsigned wid, bool signed_flag)
: NetEUnary(op__, ex, wid, signed_flag)
{
@ -3093,13 +3083,6 @@ bool NetProc::check_synth(ivl_process_type_t /* pr_type */,
// : Non-constant system functions need a warning (NetESFunc).
// : Constant functions should already be elaborated.
/* By default assign elements can be synthesized. */
bool NetAssignBase::check_synth(ivl_process_type_t /* pr_type */,
const NetScope* /* scope */ ) const
{
return false;
}
bool NetAssign::check_synth(ivl_process_type_t pr_type,
const NetScope* /* scope */ ) const
{
@ -3423,13 +3406,6 @@ bool NetForLoop::check_synth(ivl_process_type_t pr_type,
return result;
}
// The delay check above has already marked this as an error.
bool NetPDelay::check_synth(ivl_process_type_t /* pr_type */,
const NetScope* /* scope */ ) const
{
return false;
}
bool NetRelease::check_synth(ivl_process_type_t pr_type,
const NetScope* /* scope */ ) const
{

View File

@ -1,7 +1,7 @@
#ifndef IVL_netlist_H
#define IVL_netlist_H
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1290,9 +1290,9 @@ class NetScope : public Definitions, public Attrib {
private:
void evaluate_type_parameter_(Design*des, param_ref_t cur);
void evaluate_parameter_logic_(Design*des, param_ref_t cur);
void evaluate_parameter_real_(Design*des, param_ref_t cur);
void evaluate_parameter_string_(Design*des, param_ref_t cur);
static void evaluate_parameter_logic_(Design*des, param_ref_t cur);
static void evaluate_parameter_real_(Design*des, param_ref_t cur);
static void evaluate_parameter_string_(Design*des, param_ref_t cur);
void evaluate_parameter_(Design*des, param_ref_t cur);
private:
@ -2502,7 +2502,7 @@ class NetLiteral : public NetNode {
explicit NetLiteral(NetScope*s, perm_string n, const verireal&val);
~NetLiteral() override;
ivl_variable_type_t data_type() const;
static ivl_variable_type_t data_type();
const verireal& value_real() const;
@ -2861,6 +2861,9 @@ class NetAssign_ {
explicit NetAssign_(NetNet*sig);
~NetAssign_();
NetAssign_(const NetAssign_&) = delete;
NetAssign_& operator=(const NetAssign_&) = delete;
// This is so NetAssign_ objects can be passed to ivl_assert
// and other macros that call this method.
std::string get_fileline() const;
@ -2991,7 +2994,6 @@ class NetAssignBase : public NetProc {
// This dumps all the lval structures.
void dump_lval(std::ostream&) const;
virtual void dump(std::ostream&, unsigned ind) const override;
virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override;
private:
NetAssign_*lval_;
@ -3816,7 +3818,6 @@ class NetPDelay : public NetProc {
virtual bool emit_proc(struct target_t*) const override;
virtual void dump(std::ostream&, unsigned ind) const override;
virtual DelayType delay_type(bool print_delay=false) const override;
virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override;
bool emit_proc_recurse(struct target_t*) const;
@ -4785,7 +4786,7 @@ class NetESFunc : public NetExpr {
/* A dummy value to properly close the enum. */
DUMMY = 0xffffffff };
bool takes_nargs_(ID func, unsigned nargs) {
static bool takes_nargs_(ID func, unsigned nargs) {
if (nargs > 15) nargs = 15;
return func & (1U << (nargs + 16));
}
@ -4801,8 +4802,8 @@ class NetESFunc : public NetExpr {
NetExpr* evaluate_two_arg_(ID id, const NetExpr*arg0,
const NetExpr*arg1) const;
NetEConst* evaluate_rtoi_(const NetExpr*arg) const;
NetECReal* evaluate_itor_(const NetExpr*arg) const;
static NetEConst* evaluate_rtoi_(const NetExpr*arg);
static NetECReal* evaluate_itor_(const NetExpr*arg);
NetEConst* evaluate_clog2_(const NetExpr*arg) const;
@ -4820,7 +4821,7 @@ class NetESFunc : public NetExpr {
NetEConst* evaluate_isunknown_(const NetExpr*arg) const;
NetEConst* evaluate_onehot_(const NetExpr*arg) const;
NetEConst* evaluate_onehot0_(const NetExpr*arg) const;
NetEConst* evaluate_unpacked_dimensions_(const NetExpr*arg) const;
static NetEConst* evaluate_unpacked_dimensions_(const NetExpr*arg);
/* This value is used as a default when the array functions are
* called with a single argument. */
@ -4963,7 +4964,6 @@ class NetEUBits : public NetEUnary {
virtual NetNet* synthesize(Design*, NetScope*scope, NetExpr*root) override;
virtual NetEUBits* dup_expr() const override;
virtual ivl_variable_type_t expr_type() const override;
};
class NetEUReduce : public NetEUnary {
@ -4974,7 +4974,6 @@ class NetEUReduce : public NetEUnary {
virtual NetNet* synthesize(Design*, NetScope*scope, NetExpr*root) override;
virtual NetEUReduce* dup_expr() const override;
virtual ivl_variable_type_t expr_type() const override;
private:
virtual NetEConst* eval_arguments_(const NetExpr*ex) const override;

View File

@ -1,7 +1,7 @@
%{
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -3910,7 +3910,7 @@ expr_primary
int rdigit = pform_get_timeunit() - pform_get_timeprec();
assert(rdigit >= 0);
double scale = pow(10.0, (double)rdigit);
time = round(time*scale)/scale;
time = std::round(time*scale)/scale;
verireal *v = new verireal(time);
$$ = new PEFNumber(v);
@ -7052,7 +7052,7 @@ statement_item /* This is roughly statement_item in the LRM */
| hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';'
{ /* ....randomize with { <constraints> } */
if ($1 && peek_tail_name(*$1) == "randomize") {
if (peek_tail_name(*$1) == "randomize") {
if (pform_requires_sv(@2, "Randomize with constraint"))
yyerror(@2, "sorry: Randomize with constraint not supported.");
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -2192,7 +2192,7 @@ void pform_make_events(const struct vlltype&loc, const list<pform_ident_t>*names
*/
static void pform_makegate(PGBuiltin::Type type,
struct str_pair_t str,
list<PExpr*>* delay,
const list<PExpr*>*delay,
const lgate&info,
list<named_pexpr_t>*attr)
{
@ -2235,7 +2235,7 @@ static void pform_makegate(PGBuiltin::Type type,
void pform_makegates(const struct vlltype&loc,
PGBuiltin::Type type,
struct str_pair_t str,
list<PExpr*>*delay,
const list<PExpr*>*delay,
std::vector<lgate>*gates,
list<named_pexpr_t>*attr)
{

View File

@ -1,7 +1,7 @@
#ifndef IVL_pform_H
#define IVL_pform_H
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 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
@ -474,7 +474,7 @@ extern void pform_make_events(const struct vlltype&loc,
extern void pform_makegates(const struct vlltype&loc,
PGBuiltin::Type type,
struct str_pair_t str,
std::list<PExpr*>*delay,
const std::list<PExpr*>*delay,
std::vector<lgate>*gates,
std::list<named_pexpr_t>*attr);

View File

@ -1,7 +1,7 @@
#ifndef IVL_pform_types_H
#define IVL_pform_types_H
/*
* Copyright (c) 2007-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2026 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
@ -451,7 +451,7 @@ struct pform_scoped_name_t {
pform_scoped_name_t() = default;
pform_scoped_name_t(PPackage *p, const pform_name_t &n) : package(p),
name(n) {}
pform_scoped_name_t(const pform_name_t &n) : name(n) {}
explicit pform_scoped_name_t(const pform_name_t &n) : name(n) {}
const name_component_t& back() const { return name.back(); }
size_t size() const { return name.size(); }

View File

@ -1,7 +1,7 @@
#ifndef IVL_nex_data_H
#define IVL_nex_data_H
/*
* Copyright (c) 2013-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2013-2026 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,6 +34,8 @@ class blif_nex_data_t {
// function can create these objects.
explicit blif_nex_data_t(ivl_nexus_t nex);
~blif_nex_data_t();
blif_nex_data_t(const blif_nex_data_t&) = delete;
blif_nex_data_t& operator=(const blif_nex_data_t&) = delete;
public:
// Return the blif_nex_data_t object that is associated with

View File

@ -6,3 +6,16 @@ unusedFunction:vhdl.cc:96
// target_query()
unusedFunction:vhdl.cc:137
// Skip the use STL messages
useStlAlgorithm
// cppcheck does not notice that the condition is asserted to be true at least once
nullPointer:stmt.cc:1543
// Other unused functions
unusedFunction:expr.cc
unusedFunction:vhdl_element.cc
unusedFunction:vhdl_syntax.cc
unusedFunction:vhdl_syntax.hh
unusedFunction:vhdl_type.cc

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for scopes.
*
* Copyright (C) 2008-2025 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -1044,12 +1044,12 @@ extern "C" int draw_functions(ivl_scope_t scope, void *_parent)
ivl_scope_t parent = static_cast<ivl_scope_t>(_parent);
if (ivl_scope_type(scope) == IVL_SCT_FUNCTION) {
if (draw_function(scope, parent) != 0)
return 1;
int rc = draw_function(scope, parent);
assert(rc == 0);
}
else if (ivl_scope_type(scope) == IVL_SCT_TASK) {
if (draw_task(scope, parent) != 0)
return 1;
int rc = draw_task(scope, parent);
assert(rc == 0);
}
return ivl_scope_children(scope, draw_functions, scope);
@ -1258,8 +1258,7 @@ int draw_scope(ivl_scope_t scope, void *_parent)
return rc;
rc = draw_constant_drivers(scope, _parent);
if (rc != 0)
return rc;
assert(rc == 0);
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* VHDL code generation for statements.
*
* Copyright (C) 2008-2025 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -1495,6 +1495,7 @@ int draw_casezx(vhdl_procedural *proc, stmt_container *container,
vhdl_if_stmt *result = NULL;
int nbranches = ivl_stmt_case_count(stmt);
assert(nbranches > 0);
bool is_casez = ivl_statement_type(stmt) == IVL_ST_CASEZ;
for (int i = 0; i < nbranches; i++) {
stmt_container *where = NULL;
@ -1564,8 +1565,7 @@ int draw_while(vhdl_procedural *proc, stmt_container *container,
// When we are emitting a for as a while we need to add the step
if (step) {
rc = draw_assign(proc, &tmp_container, step);
if (rc != 0)
return rc;
assert(rc == 0);
}
vhdl_expr *test = translate_expr(ivl_stmt_cond_expr(stmt));
@ -1585,8 +1585,7 @@ int draw_while(vhdl_procedural *proc, stmt_container *container,
// When we are emitting a for as a while we need to add the step
if (step) {
rc = draw_assign(proc, loop->get_container(), step);
if (rc != 0)
return rc;
assert(rc == 0);
}
emit_wait_for_0(proc, loop->get_container(), stmt, test);
@ -1599,8 +1598,7 @@ int draw_for_loop(vhdl_procedural *proc, stmt_container *container,
ivl_statement_t stmt)
{
int rc = draw_assign(proc, container, ivl_stmt_init_stmt(stmt));
if (rc != 0)
return rc;
assert(rc == 0);
return draw_while(proc, container, stmt, ivl_stmt_step_stmt(stmt));
}

View File

@ -1,7 +1,7 @@
/*
* Support functions for VHDL output.
*
* Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -80,14 +80,14 @@ vhdl_type *support_function::function_type(support_function_t type)
return vhdl_type::boolean();
}
void support_function::emit_ternary(std::ostream &of, int level) const
void support_function::emit_ternary(std::ostream &of, int level)
{
of << nl_string(level) << "begin" << nl_string(indent(level))
<< "if T then return X; else return Y; end if;";
}
void support_function::emit_reduction(std::ostream &of, int level,
const char *op, char unit) const
const char *op, char unit)
{
// Emit a VHDL function emulating a Verilog reduction operator
// Where op is the corresponding VHDL operator and unit is the

View File

@ -1,7 +1,7 @@
/*
* Support functions for VHDL output.
*
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -44,14 +44,14 @@ public:
explicit support_function(support_function_t type)
: vhdl_function(function_name(type), function_type(type)),
type_(type) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
static const char *function_name(support_function_t type);
static vhdl_type *function_type(support_function_t type);
private:
void emit_ternary(std::ostream &of, int level) const;
void emit_reduction(std::ostream &of, int level, const char *op,
char unit) const;
static void emit_ternary(std::ostream &of, int level);
static void emit_reduction(std::ostream &of, int level, const char *op,
char unit);
support_function_t type_;
};

View File

@ -1,7 +1,7 @@
/*
* VHDL abstract syntax elements.
*
* Copyright (C) 2008-2025 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -531,11 +531,6 @@ void vhdl_expr_list::add_expr(vhdl_expr *e)
exprs_.push_back(e);
}
vhdl_expr_list::~vhdl_expr_list()
{
}
void vhdl_expr_list::find_vars(vhdl_var_set_t& read)
{
for (list<vhdl_expr*>::const_iterator it = exprs_.begin();

View File

@ -1,7 +1,7 @@
/*
* VHDL abstract syntax elements.
*
* Copyright (C) 2008-2025 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -38,7 +38,7 @@ class vhdl_expr : public vhdl_element {
public:
explicit vhdl_expr(const vhdl_type* type, bool isconst=false)
: type_(type), isconst_(isconst) {}
virtual ~vhdl_expr();
virtual ~vhdl_expr() override;
const vhdl_type *get_type() const { return type_; }
bool constant() const { return isconst_; }
@ -71,13 +71,13 @@ public:
vhdl_var_ref(const std::string& name, const vhdl_type *type,
vhdl_expr *slice = NULL)
: vhdl_expr(type), name_(name), slice_(slice), slice_width_(0) {}
~vhdl_var_ref();
~vhdl_var_ref() override;
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
const std::string &get_name() const { return name_; }
void set_name(const std::string &name) { name_ = name; }
void set_slice(vhdl_expr *s, int w=0);
void find_vars(vhdl_var_set_t& read);
void find_vars(vhdl_var_set_t& read) override;
private:
std::string name_;
vhdl_expr *slice_;
@ -121,12 +121,12 @@ public:
: vhdl_expr(type), op_(op) {}
vhdl_binop_expr(vhdl_expr *left, vhdl_binop_t op,
vhdl_expr *right, const vhdl_type *type);
~vhdl_binop_expr();
~vhdl_binop_expr() override;
void add_expr(vhdl_expr *e);
void add_expr_front(vhdl_expr *e);
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read) override;
private:
std::list<vhdl_expr*> operands_;
vhdl_binop_t op_;
@ -143,10 +143,10 @@ public:
vhdl_unaryop_expr(vhdl_unaryop_t op, vhdl_expr *operand,
const vhdl_type *type)
: vhdl_expr(type), op_(op), operand_(operand) {}
~vhdl_unaryop_expr();
~vhdl_unaryop_expr() override;
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read) override;
private:
vhdl_unaryop_t op_;
vhdl_expr *operand_;
@ -160,10 +160,10 @@ class vhdl_bit_spec_expr : public vhdl_expr {
public:
vhdl_bit_spec_expr(const vhdl_type *type, vhdl_expr *others)
: vhdl_expr(type), others_(others) {}
~vhdl_bit_spec_expr();
~vhdl_bit_spec_expr() override;
void add_bit(int bit, vhdl_expr *e);
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
vhdl_expr *others_;
struct bit_map {
@ -179,7 +179,7 @@ public:
explicit vhdl_const_string(const std::string& value)
: vhdl_expr(vhdl_type::string(), true), value_(value) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
std::string value_;
};
@ -188,12 +188,12 @@ class vhdl_const_bits : public vhdl_expr {
public:
vhdl_const_bits(const char *value, int width, bool issigned,
bool qualify=false);
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
const std::string &get_value() const { return value_; }
vhdl_expr *to_integer();
vhdl_expr *to_std_logic();
vhdl_expr *to_vector(vhdl_type_name_t name, int w);
vhdl_expr *resize(int w);
vhdl_expr *to_integer() override;
vhdl_expr *to_std_logic() override;
vhdl_expr *to_vector(vhdl_type_name_t name, int w) override;
vhdl_expr *resize(int w) override;
private:
int64_t bits_to_int() const;
char sign_bit() const;
@ -207,11 +207,11 @@ class vhdl_const_bit : public vhdl_expr {
public:
explicit vhdl_const_bit(char bit)
: vhdl_expr(vhdl_type::std_logic(), true), bit_(bit) {}
void emit(std::ostream &of, int level) const;
vhdl_expr *to_boolean();
vhdl_expr *to_integer();
vhdl_expr *to_vector(vhdl_type_name_t name, int w);
vhdl_expr *to_std_ulogic();
void emit(std::ostream &of, int level) const override;
vhdl_expr *to_boolean() override;
vhdl_expr *to_integer() override;
vhdl_expr *to_vector(vhdl_type_name_t name, int w) override;
vhdl_expr *to_std_ulogic() override;
private:
char bit_;
};
@ -227,7 +227,7 @@ class vhdl_const_time : public vhdl_expr {
public:
explicit vhdl_const_time(uint64_t value, time_unit_t units = TIME_UNIT_NS)
: vhdl_expr(vhdl_type::time(), true), value_(value), units_(units) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
uint64_t value_;
time_unit_t units_;
@ -237,8 +237,8 @@ class vhdl_const_int : public vhdl_expr {
public:
explicit vhdl_const_int(int64_t value)
: vhdl_expr(vhdl_type::integer(), true), value_(value) {}
void emit(std::ostream &of, int level) const;
vhdl_expr *to_vector(vhdl_type_name_t name, int w);
void emit(std::ostream &of, int level) const override;
vhdl_expr *to_vector(vhdl_type_name_t name, int w) override;
private:
int64_t value_;
};
@ -247,16 +247,14 @@ class vhdl_const_bool : public vhdl_expr {
public:
explicit vhdl_const_bool(bool value)
: vhdl_expr(vhdl_type::boolean(), true), value_(value) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
bool value_;
};
class vhdl_expr_list : public vhdl_element {
public:
~vhdl_expr_list();
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
bool empty() const { return exprs_.empty(); }
void add_expr(vhdl_expr *e);
void find_vars(vhdl_var_set_t& read);
@ -272,11 +270,11 @@ class vhdl_fcall : public vhdl_expr {
public:
vhdl_fcall(const std::string& name, const vhdl_type *rtype)
: vhdl_expr(rtype), name_(name) {};
~vhdl_fcall() {}
~vhdl_fcall() override {}
void add_expr(vhdl_expr *e) { exprs_.add_expr(e); }
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read) override;
private:
std::string name_;
vhdl_expr_list exprs_;
@ -286,8 +284,6 @@ private:
* A concurrent statement appears in architecture bodies/
*/
class vhdl_conc_stmt : public vhdl_element {
public:
virtual ~vhdl_conc_stmt() {}
};
typedef std::list<vhdl_conc_stmt*> conc_stmt_list_t;
@ -311,9 +307,9 @@ class vhdl_cassign_stmt : public vhdl_conc_stmt {
public:
vhdl_cassign_stmt(vhdl_var_ref *lhs, vhdl_expr *rhs)
: lhs_(lhs), rhs_(rhs), after_(NULL) {}
~vhdl_cassign_stmt();
~vhdl_cassign_stmt() override;
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void add_condition(vhdl_expr *value, vhdl_expr *cond);
void set_after(vhdl_expr *a) { after_ = a; }
private:
@ -328,9 +324,9 @@ class vhdl_with_select_stmt : public vhdl_conc_stmt {
public:
vhdl_with_select_stmt(vhdl_expr *test, vhdl_var_ref *out)
: test_(test), out_(out), others_(NULL) {}
~vhdl_with_select_stmt();
~vhdl_with_select_stmt() override;
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void add_condition(vhdl_expr *value, vhdl_expr *cond, vhdl_expr *delay=NULL);
void add_default(vhdl_expr* value);
private:
@ -346,8 +342,6 @@ private:
*/
class vhdl_seq_stmt : public vhdl_element {
public:
virtual ~vhdl_seq_stmt() {}
// Find all the variables that are read or written in the
// expressions within this statement
// This is used to clean up the VHDL output
@ -384,10 +378,10 @@ class vhdl_abstract_assign_stmt : public vhdl_seq_stmt {
public:
vhdl_abstract_assign_stmt(vhdl_var_ref *lhs, vhdl_expr *rhs)
: lhs_(lhs), rhs_(rhs), after_(NULL) {}
virtual ~vhdl_abstract_assign_stmt();
virtual ~vhdl_abstract_assign_stmt() override;
void set_after(vhdl_expr *after) { after_ = after; }
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
protected:
vhdl_var_ref *lhs_;
vhdl_expr *rhs_, *after_;
@ -403,7 +397,7 @@ public:
vhdl_nbassign_stmt(vhdl_var_ref *lhs, vhdl_expr *rhs)
: vhdl_abstract_assign_stmt(lhs, rhs) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
};
@ -412,7 +406,7 @@ public:
vhdl_assign_stmt(vhdl_var_ref *lhs, vhdl_expr *rhs)
: vhdl_abstract_assign_stmt(lhs, rhs) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
};
@ -430,15 +424,15 @@ enum vhdl_wait_type_t {
*/
class vhdl_wait_stmt : public vhdl_seq_stmt {
public:
vhdl_wait_stmt(vhdl_wait_type_t type = VHDL_WAIT_INDEF,
explicit vhdl_wait_stmt(vhdl_wait_type_t type = VHDL_WAIT_INDEF,
vhdl_expr *expr = NULL)
: type_(type), expr_(expr) {}
~vhdl_wait_stmt();
~vhdl_wait_stmt() override;
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void add_sensitivity(const std::string &s) { sensitivity_.push_back(s); }
vhdl_wait_type_t get_type() const { return type_; }
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
vhdl_wait_type_t type_;
vhdl_expr *expr_;
@ -448,8 +442,8 @@ private:
class vhdl_null_stmt : public vhdl_seq_stmt {
public:
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t&, vhdl_var_set_t&) {}
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t&, vhdl_var_set_t&) override {}
};
@ -464,10 +458,10 @@ class vhdl_report_stmt : public vhdl_seq_stmt {
public:
explicit vhdl_report_stmt(vhdl_expr *text,
vhdl_severity_t severity = SEVERITY_NOTE);
virtual ~vhdl_report_stmt() {}
virtual ~vhdl_report_stmt() override {}
virtual void emit(std::ostream& of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
virtual void emit(std::ostream& of, int level) const override;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
vhdl_severity_t severity_;
vhdl_expr *text_;
@ -478,20 +472,20 @@ class vhdl_assert_stmt : public vhdl_report_stmt {
public:
explicit vhdl_assert_stmt(const char *reason);
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
};
class vhdl_if_stmt : public vhdl_seq_stmt {
public:
explicit vhdl_if_stmt(vhdl_expr *test);
~vhdl_if_stmt();
~vhdl_if_stmt() override;
stmt_container *get_then_container() { return &then_part_; }
stmt_container *get_else_container() { return &else_part_; }
stmt_container *add_elsif(vhdl_expr *test);
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
struct elsif {
vhdl_expr *test;
@ -512,10 +506,10 @@ class vhdl_case_branch : public vhdl_element {
friend class vhdl_case_stmt;
public:
explicit vhdl_case_branch(vhdl_expr *when) : when_(when) {}
~vhdl_case_branch();
~vhdl_case_branch() override;
stmt_container *get_container() { return &stmts_; }
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
vhdl_expr *when_;
stmt_container stmts_;
@ -526,11 +520,11 @@ typedef std::list<vhdl_case_branch*> case_branch_list_t;
class vhdl_case_stmt : public vhdl_seq_stmt {
public:
explicit vhdl_case_stmt(vhdl_expr *test) : test_(test) {}
~vhdl_case_stmt();
~vhdl_case_stmt() override;
void add_branch(vhdl_case_branch *b) { branches_.push_back(b); }
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
vhdl_expr *test_;
case_branch_list_t branches_;
@ -539,12 +533,10 @@ private:
class vhdl_loop_stmt : public vhdl_seq_stmt {
public:
virtual ~vhdl_loop_stmt() {}
stmt_container *get_container() { return &stmts_; }
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
virtual void find_vars(vhdl_var_set_t& read,
vhdl_var_set_t& write);
vhdl_var_set_t& write) override;
private:
stmt_container stmts_;
};
@ -553,10 +545,10 @@ private:
class vhdl_while_stmt : public vhdl_loop_stmt {
public:
explicit vhdl_while_stmt(vhdl_expr *test) : test_(test) {}
~vhdl_while_stmt();
~vhdl_while_stmt() override;
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
vhdl_expr *test_;
};
@ -566,10 +558,10 @@ class vhdl_for_stmt : public vhdl_loop_stmt {
public:
vhdl_for_stmt(const char *lname, vhdl_expr *from, vhdl_expr *to)
: lname_(lname), from_(from), to_(to) {}
~vhdl_for_stmt();
~vhdl_for_stmt() override;
void emit(std::ostream &of, int level) const;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void emit(std::ostream &of, int level) const override;
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
const char *lname_;
vhdl_expr *from_, *to_;
@ -584,9 +576,9 @@ class vhdl_pcall_stmt : public vhdl_seq_stmt {
public:
explicit vhdl_pcall_stmt(const char *name) : name_(name) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void add_expr(vhdl_expr *e) { exprs_.add_expr(e); }
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write);
void find_vars(vhdl_var_set_t& read, vhdl_var_set_t& write) override;
private:
std::string name_;
vhdl_expr_list exprs_;
@ -604,7 +596,7 @@ public:
vhdl_expr *initial = NULL)
: name_(name), type_(type), initial_(initial),
has_initial_(initial != NULL) {}
virtual ~vhdl_decl();
virtual ~vhdl_decl() override;
const std::string &get_name() const { return name_; }
const vhdl_type *get_type() const;
@ -654,7 +646,7 @@ class vhdl_component_decl : public vhdl_decl {
public:
static vhdl_component_decl *component_decl_for(vhdl_entity *ent);
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
explicit vhdl_component_decl(const char *name);
@ -666,7 +658,7 @@ class vhdl_type_decl : public vhdl_decl {
public:
vhdl_type_decl(const std::string& name, const vhdl_type *base)
: vhdl_decl(name, base) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
};
/*
@ -677,8 +669,8 @@ class vhdl_var_decl : public vhdl_decl {
public:
vhdl_var_decl(const std::string& name, const vhdl_type *type)
: vhdl_decl(name, type) {}
void emit(std::ostream &of, int level) const;
assign_type_t assignment_type() const { return ASSIGN_BLOCK; }
void emit(std::ostream &of, int level) const override;
assign_type_t assignment_type() const override { return ASSIGN_BLOCK; }
};
@ -689,8 +681,8 @@ class vhdl_signal_decl : public vhdl_decl {
public:
vhdl_signal_decl(const std::string& name, const vhdl_type* type)
: vhdl_decl(name, type) {}
virtual void emit(std::ostream &of, int level) const;
assign_type_t assignment_type() const { return ASSIGN_NONBLOCK; }
virtual void emit(std::ostream &of, int level) const override;
assign_type_t assignment_type() const override { return ASSIGN_NONBLOCK; }
};
@ -701,8 +693,8 @@ class vhdl_param_decl : public vhdl_decl {
public:
vhdl_param_decl(const char *name, const vhdl_type *type)
: vhdl_decl(name, type) {}
void emit(std::ostream &of, int level) const;
assign_type_t assignment_type() const { return ASSIGN_CONST; }
void emit(std::ostream &of, int level) const override;
assign_type_t assignment_type() const override { return ASSIGN_CONST; }
};
enum vhdl_port_mode_t {
@ -723,12 +715,12 @@ public:
vhdl_port_mode_t mode)
: vhdl_decl(name, type), mode_(mode) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
vhdl_port_mode_t get_mode() const { return mode_; }
void set_mode(vhdl_port_mode_t m) { mode_ = m; }
assign_type_t assignment_type() const { return ASSIGN_NONBLOCK; }
void ensure_readable();
bool is_readable() const;
assign_type_t assignment_type() const override { return ASSIGN_NONBLOCK; }
void ensure_readable() override;
bool is_readable() const override;
private:
vhdl_port_mode_t mode_;
};
@ -750,9 +742,9 @@ typedef std::list<port_map_t> port_map_list_t;
class vhdl_comp_inst : public vhdl_conc_stmt {
public:
vhdl_comp_inst(const char *inst_name, const char *comp_name);
~vhdl_comp_inst();
~vhdl_comp_inst() override;
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void map_port(const std::string& name, vhdl_expr *expr);
const std::string &get_comp_name() const { return comp_name_; }
@ -841,8 +833,8 @@ class vhdl_function : public vhdl_decl, public vhdl_procedural {
public:
vhdl_function(const char *name, vhdl_type *ret_type);
virtual void emit(std::ostream &of, int level) const;
vhdl_scope *get_scope() { return &variables_; }
virtual void emit(std::ostream &of, int level) const override;
vhdl_scope *get_scope() override { return &variables_; }
void add_param(vhdl_param_decl *p) { scope_.add_decl(p); }
private:
vhdl_scope variables_;
@ -853,7 +845,7 @@ public:
explicit vhdl_forward_fdecl(const vhdl_function *f)
: vhdl_decl((f->get_name() + "_Forward").c_str()), f_(f) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
private:
const vhdl_function *f_;
};
@ -863,7 +855,7 @@ class vhdl_process : public vhdl_conc_stmt, public vhdl_procedural {
public:
explicit vhdl_process(const char *name = "") : name_(name) {}
void emit(std::ostream &of, int level) const;
void emit(std::ostream &of, int level) const override;
void add_sensitivity(const std::string &name);
private:
std::string name_;
@ -878,9 +870,9 @@ class vhdl_arch : public vhdl_element {
public:
vhdl_arch(const std::string& entity, const std::string& name)
: name_(name), entity_(entity) {}
virtual ~vhdl_arch();
virtual ~vhdl_arch() override;
void emit(std::ostream &of, int level=0) const;
void emit(std::ostream &of, int level=0) const override;
void add_stmt(vhdl_process *proc);
void add_stmt(vhdl_conc_stmt *stmt);
vhdl_scope *get_scope() { return &scope_; }
@ -899,9 +891,9 @@ private:
class vhdl_entity : public vhdl_element {
public:
vhdl_entity(const std::string& name, vhdl_arch *arch, int depth=0);
virtual ~vhdl_entity();
virtual ~vhdl_entity() override;
void emit(std::ostream &of, int level=0) const;
void emit(std::ostream &of, int level=0) const override;
void add_port(vhdl_port_decl *decl);
vhdl_arch *get_arch() const { return arch_; }
const std::string &get_name() const { return name_; }

View File

@ -1,7 +1,7 @@
/*
* VHDL variable and signal types.
*
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2026 Nick Gasson (nick@nickg.me.uk)
*
* 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
@ -58,9 +58,11 @@ public:
// Copy constructor
vhdl_type(const vhdl_type &other);
virtual ~vhdl_type();
virtual ~vhdl_type() override;
void emit(std::ostream &of, int level) const;
vhdl_type& operator=(const vhdl_type&) = delete;
void emit(std::ostream &of, int level) const override;
vhdl_type_name_t get_name() const { return name_; }
std::string get_string() const;
std::string get_decl_string() const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2026 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
@ -228,7 +228,7 @@ verinum::verinum(double val, bool)
/* Round to the nearest integer now, as this may increase the
number of bits we need to allocate. */
val = round(val);
val = std::round(val);
/* Get the exponent and fractional part of the number. */
fraction = frexp(val, &exponent);

View File

@ -1,7 +1,7 @@
#ifndef IVL_architec_H
#define IVL_architec_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 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
@ -193,6 +193,9 @@ class SignalAssignment : public Architecture::Statement {
SignalAssignment(ExpName*target, Expression*rval);
~SignalAssignment() override;
SignalAssignment(const SignalAssignment&) = delete;
SignalAssignment& operator=(const SignalAssignment&) = delete;
virtual int elaborate(Entity*ent, Architecture*arc) override;
virtual int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
virtual void dump(std::ostream&out, int ident =0) const override;
@ -208,6 +211,9 @@ class CondSignalAssignment : public Architecture::Statement {
CondSignalAssignment(ExpName*target, std::list<ExpConditional::case_t*>&options);
~CondSignalAssignment() override;
CondSignalAssignment(const CondSignalAssignment&) = delete;
CondSignalAssignment& operator=(const CondSignalAssignment&) = delete;
int elaborate(Entity*ent, Architecture*arc) override;
int emit(std::ostream&out, Entity*entity, Architecture*arc) override;
void dump(std::ostream&out, int ident =0) const override;

View File

@ -1,9 +1,38 @@
// cppcheck is wrong
// text is used in strchr()/strrchr() which take a char* not a const char*
constParameterPointer:lexor.lex:698
// Skip the use STL messages
useStlAlgorithm
// Errors/limitations in the generated yacc and lex files
cstyleCast:lexor.cc
constVariablePointer:lexor.cc
duplicateBreak:lexor.lex
redundantInitialization:lexor.cc
unusedFunction:lexor.cc
unusedStructMember:lexor.cc
uselessAssignmentPtrArg:lexor.cc
duplicateBreak:lexor.lex
redundantInitialization:lexor.lex
uselessAssignmentPtrArg:lexor.lex
constParameterPointer:parse.cc
invalidPrintfArgType_sint:parse.cc
knownConditionTrueFalse:parse.cc
syntaxError:parse.cc
unsignedPositive:parse.cc
// Unused functions
unusedFunction:LineInfo.h
unusedFunction:StringHeap.cc
unusedFunction:architec.h
unusedFunction:expression.cc
unusedFunction:expression.h
unusedFunction:parse_types.h
unusedFunction:scope.cc
unusedFunction:sequential.cc
unusedFunction:sequential.h
unusedFunction:std_types.cc
unusedFunction:subprogram.cc
unusedFunction:subprogram.h
unusedFunction:vhdlint.cc
unusedFunction:vtype.cc

View File

@ -1,7 +1,7 @@
#ifndef IVL_entity_H
#define IVL_entity_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 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,7 @@ class Expression;
class InterfacePort : public LineInfo {
public:
InterfacePort(port_mode_t mod = PORT_NONE,
explicit InterfacePort(port_mode_t mod = PORT_NONE,
perm_string nam = empty_perm_string,
const VType*typ = NULL,
Expression*exp = NULL)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012-2015 / Stephen Williams (steve@icarus.com),
* Copyright CERN 2016
* @author Maciej Suminski (maciej.suminski@cern.ch)
@ -913,7 +913,7 @@ double ExpTime::to_fs() const
ExpRange::ExpRange(Expression*left_idx, Expression*right_idx, range_dir_t dir)
: left_(left_idx), right_(right_idx), direction_(dir), range_expr_(false),
range_base_(NULL)
range_base_(NULL), range_reverse_(false)
{
}

View File

@ -1,7 +1,7 @@
#ifndef IVL_expression_H
#define IVL_expression_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2015 / Stephen Williams (steve@icarus.com),
* Copyright CERN 2016
* @author Maciej Suminski (maciej.suminski@cern.ch)
@ -284,7 +284,7 @@ class ExpAggregate : public Expression {
};
struct choice_element {
choice_element() : choice(), expr() {}
choice_element() : choice(), expr(), alias_flag(false) {}
choice_element(const choice_element&other) {
choice = other.choice ? new choice_t(*other.choice) : NULL;
@ -451,7 +451,7 @@ class ExpBitstring : public Expression {
public:
explicit ExpBitstring(const char*);
ExpBitstring(const ExpBitstring&other) : Expression() { value_ = other.value_; }
ExpBitstring(const ExpBitstring&other) : Expression(), value_(other.value_) {}
~ExpBitstring() override;
Expression*clone() const override { return new ExpBitstring(*this); }
@ -557,7 +557,6 @@ class ExpConditional : public Expression {
virtual Expression*clone() const override;
const VType*probe_type(Entity*ent, ScopeBase*scope) const override;
int elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype) override;
void write_to_stream(std::ostream&fd) const override;
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const override;
@ -751,6 +750,9 @@ class ExpName : public Expression {
delete offset_;
}
index_t(const index_t&) = delete;
index_t& operator=(const index_t&) = delete;
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) const;
private:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
* Copyright CERN 2016
* @author Maciej Suminski (maciej.suminski@cern.ch)
@ -797,11 +797,6 @@ int ExpConcat::elaborate_expr_array_(Entity*ent, ScopeBase*scope, const VTypeArr
return errors;
}
const VType* ExpConditional::probe_type(Entity*, ScopeBase*) const
{
return 0;
}
int ExpConditional::elaborate_expr(Entity*ent, ScopeBase*scope, const VType*ltype)
{
int errors = 0;

View File

@ -6,7 +6,7 @@
%{
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 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
@ -318,7 +318,6 @@ static bool is_based_correct(const char* text)
if(strchr(text, '\0') - strrchr(text, '#') > 1) { //the number contains an exponent
if(*(strrchr(text, '#') + 2) == '-')
return 0;
length = 0;
for(ptr = strrchr(text, '#')+2; *ptr != '\0'; ++ptr)
{
//the exponent consists of other chars than {'0'.,'9','a'..'f'}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
* Copyright CERN 2016
* @author Maciej Suminski <maciej.suminski@cern.ch>
@ -125,10 +125,10 @@ static void dump_library_package(ostream&file, perm_string lname, perm_string pn
file << "end package " << lname << "." << pname << endl;
}
static void dump_library_packages(ostream&file, perm_string lname, map<perm_string,Package*>packages)
static void dump_library_packages(ostream&file, perm_string lname, const map<perm_string,Package*>&packages)
{
for (map<perm_string,Package*>::iterator cur = packages.begin()
; cur != packages.end() ; ++cur) {
for (map<perm_string,Package*>::const_iterator cur = packages.cbegin()
; cur != packages.cend() ; ++cur) {
dump_library_package(file, lname, cur->first, cur->second);
}
}
@ -260,7 +260,7 @@ void library_use(const YYLTYPE&loc, ActiveScope*res,
string path = make_work_package_path(use_package.str());
parse_source_file(path.c_str(), use_library);
pack = lib.packages[use_package];
} else if (use_library != "ieee" && pack == 0) {
} else if (pack == 0) {
string path = make_library_package_path(use_library, use_package);
if (path == "") {
errormsg(loc, "Unable to find library %s\n", use_library.str());

View File

@ -1,7 +1,7 @@
#ifndef IVL_parse_types_H
#define IVL_parse_types_H
/*
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -48,6 +48,9 @@ class entity_aspect_t {
entity_aspect_t(entity_aspect_type_t t, ExpName* n) : type_(t), name_(n) {}
~entity_aspect_t() { delete name_; }
entity_aspect_t(const entity_aspect_t&) = delete;
entity_aspect_t& operator=(const entity_aspect_t&) = delete;
ExpName* name() const { return name_; }
entity_aspect_type_t type() const {return type_; }
@ -62,6 +65,9 @@ class instant_list_t {
instant_list_t(application_domain_t d, std::list<perm_string>* l) : domain_(d), labels_(l) {}
~instant_list_t() { delete labels_; }
instant_list_t(const instant_list_t&) = delete;
instant_list_t& operator=(const instant_list_t&) = delete;
std::list<perm_string>* labels() const { return labels_; }
application_domain_t domain() const { return domain_; }
@ -85,6 +91,9 @@ class file_open_info_t {
}
~file_open_info_t() { delete kind_; delete filename_; }
file_open_info_t(const file_open_info_t&) = delete;
file_open_info_t& operator=(const file_open_info_t&) = delete;
ExpName*kind() { return kind_; }
ExpString*filename() { return filename_; }

View File

@ -1,7 +1,7 @@
#ifndef IVL_scope_H
#define IVL_scope_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -141,8 +141,11 @@ class ScopeBase {
std::map<perm_string,const VType*> cur_types_; //current types
// Constant declarations...
struct const_t {
~const_t() {delete val;}
const_t(const VType*t, Expression* v) : typ(t), val(v) {};
~const_t() {delete val;}
const_t(const const_t&) = delete;
const_t& operator=(const const_t&) = delete;
const VType*typ;
Expression*val;

View File

@ -1,7 +1,7 @@
#ifndef IVL_sequential_H
#define IVL_sequential_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -106,6 +106,9 @@ class IfSequential : public SequentialStmt {
std::list<SequentialStmt*>*fa);
~IfSequential() override;
IfSequential(const IfSequential&) = delete;
IfSequential& operator=(const IfSequential&) = delete;
public:
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
@ -134,6 +137,9 @@ class ReturnStmt : public SequentialStmt {
explicit ReturnStmt(Expression*val);
~ReturnStmt() override;
ReturnStmt(const ReturnStmt&) = delete;
ReturnStmt& operator=(const ReturnStmt&) = delete;
public:
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
@ -152,6 +158,9 @@ class SignalSeqAssignment : public SequentialStmt {
SignalSeqAssignment(Expression*sig, std::list<Expression*>*wav);
~SignalSeqAssignment() override;
SignalSeqAssignment(const SignalSeqAssignment&) = delete;
SignalSeqAssignment& operator=(const SignalSeqAssignment&) = delete;
public:
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
@ -188,6 +197,9 @@ class CaseSeqStmt : public SequentialStmt {
CaseSeqStmt(Expression*cond, std::list<CaseStmtAlternative*>*sp);
~CaseSeqStmt() override;
CaseSeqStmt(const CaseSeqStmt&) = delete;
CaseSeqStmt& operator=(const CaseSeqStmt&) = delete;
public:
void dump(std::ostream&out, int indent) const override;
int elaborate(Entity*ent, ScopeBase*scope) override;
@ -207,6 +219,9 @@ class ProcedureCall : public SequentialStmt {
ProcedureCall(perm_string name, std::list<Expression*>* param_list);
~ProcedureCall() override;
ProcedureCall(const ProcedureCall&) = delete;
ProcedureCall& operator=(const ProcedureCall&) = delete;
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
void dump(std::ostream&out, int indent) const override;
@ -222,6 +237,9 @@ class VariableSeqAssignment : public SequentialStmt {
VariableSeqAssignment(Expression*sig, Expression*rval);
~VariableSeqAssignment() override;
VariableSeqAssignment(const VariableSeqAssignment&) = delete;
VariableSeqAssignment& operator=(const VariableSeqAssignment&) = delete;
public:
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*entity, ScopeBase*scope) override;
@ -239,6 +257,9 @@ class WhileLoopStatement : public LoopStatement {
Expression*, std::list<SequentialStmt*>*);
~WhileLoopStatement() override;
WhileLoopStatement(const WhileLoopStatement&) = delete;
WhileLoopStatement& operator=(const WhileLoopStatement&) = delete;
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) override;
void write_to_stream(std::ostream&fd) override;
@ -254,6 +275,9 @@ class ForLoopStatement : public LoopStatement {
perm_string index, ExpRange*, std::list<SequentialStmt*>*);
~ForLoopStatement() override;
ForLoopStatement(const ForLoopStatement&) = delete;
ForLoopStatement& operator=(const ForLoopStatement&) = delete;
int elaborate(Entity*ent, ScopeBase*scope) override;
int emit(std::ostream&out, Entity*ent, ScopeBase*scope) override;
void write_to_stream(std::ostream&fd) override;

View File

@ -1,7 +1,7 @@
#ifndef IVL_subprogram_H
#define IVL_subprogram_H
/*
* Copyright (c) 2013-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2013-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
* Copyright CERN 2015
* @author Maciej Suminski (maciej.suminski@cern.ch)
@ -69,6 +69,8 @@ class SubprogramHeader : public LineInfo {
SubprogramHeader(perm_string name, std::list<InterfacePort*>*ports,
const VType*return_type);
virtual ~SubprogramHeader() override;
SubprogramHeader(const SubprogramHeader&) = delete;
SubprogramHeader& operator=(const SubprogramHeader&) = delete;
// Return true if the specification (name, types, ports)
// matches this subprogram and that subprogram.

View File

@ -1,7 +1,7 @@
#ifndef IVL_vtype_H
#define IVL_vtype_H
/*
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2026 Stephen Williams (steve@icarus.com)
* Copyright CERN 2014 / Stephen Williams (steve@icarus.com),
* @author Maciej Suminski (maciej.suminski@cern.ch)
*
@ -126,7 +126,7 @@ class VType {
};
protected:
inline void emit_name(std::ostream&out, perm_string name) const
static inline void emit_name(std::ostream&out, perm_string name)
{
if(name != empty_perm_string)
out << " \\" << name << " ";
@ -194,7 +194,7 @@ class VTypeArray : public VType {
public:
class range_t {
public:
range_t(Expression*m = NULL, Expression*l = NULL, bool down_to = true) :
explicit range_t(Expression*m = NULL, Expression*l = NULL, bool down_to = true) :
msb_(m), lsb_(l), direction_(down_to) { }
range_t*clone() const;
@ -313,6 +313,9 @@ class VTypeRangeExpr : public VTypeRange {
VTypeRangeExpr(const VType*base, Expression*end, Expression*start, bool downto);
~VTypeRangeExpr() override;
VTypeRangeExpr(const VTypeRangeExpr&) = delete;
VTypeRangeExpr& operator=(const VTypeRangeExpr&) = delete;
VType*clone() const override;
int elaborate(Entity*end, ScopeBase*scope) const override;

View File

@ -1,97 +1,54 @@
// Skip all memory issues since they should be handled by ivl_alloc.h
ctunullpointerOutOfMemory
nullPointerArithmeticOutOfMemory
nullPointerOutOfMemory
memleakOnRealloc
// Skip strdup() not constant.
constVariablePointer:sys_vcd.c:631
constVariablePointer:sys_vcd.c:688
// Invalid issues.
// This always run once so v1 is assigned a value.
uninitvar:sys_random.c:267
// The interface is from the standard.
constParameterCallback:sys_convert.c:150
constParameterCallback:sys_display.c:1281
constParameterCallback:sys_display.c:1379
constParameterCallback:sys_display.c:1553
constParameterCallback:sys_display.c:2169
constParameterCallback:sys_fileio.c:261
constParameterCallback:sys_random.c:497
constParameterCallback:sys_sdf.c:437
constParameterCallback:sys_time.c:25
constParameterCallback:sys_time.c:81
constParameterCallback:table_mod.c:663
// Unused functions.
unusedFunction:sys_sdf.c:60
// The following three files are copied directly from GTKWave and we do not
// have control over them. Tony has a specific programming style so these
// problems will not be fixed.
// fstapi.c from GTKWave
asctimeCalled:fstapi.c:906
//allocaCalled:fstapi.c:2396
duplicateConditionalAssign:fstapi.c:4708
knownConditionTrueFalse:fstapi.c:5666
nullPointer:fstapi.c:951
nullPointer:fstapi.c:3359
shiftNegativeLHS:fstapi.c:653
shiftTooManyBits:fstapi.c:3046
shiftTooManyBits:fstapi.c:3047
shiftTooManyBits:fstapi.c:3048
shiftTooManyBits:fstapi.c:3049
shiftTooManyBitsSigned:fstapi.c:634
unreadVariable:fstapi.c:191
unreadVariable:fstapi.c:192
unreadVariable:fstapi.c:1577
unreadVariable:fstapi.c:1588
unreadVariable:fstapi.c:1595
unreadVariable:fstapi.c:1598
unreadVariable:fstapi.c:1615
unreadVariable:fstapi.c:1620
unreadVariable:fstapi.c:1623
unreadVariable:fstapi.c:1625
unreadVariable:fstapi.c:2731
unreadVariable:fstapi.c:6445
uselessAssignmentPtrArg:fstapi.c:954
variableScope:fstapi.c:646
variableScope:fstapi.c:1035
variableScope:fstapi.c:1344
variableScope:fstapi.c:1345
variableScope:fstapi.c:1346
variableScope:fstapi.c:1399
variableScope:fstapi.c:1856
variableScope:fstapi.c:1984
variableScope:fstapi.c:1986
variableScope:fstapi.c:2120
variableScope:fstapi.c:2131
variableScope:fstapi.c:2314
variableScope:fstapi.c:2832
variableScope:fstapi.c:2540
variableScope:fstapi.c:2541
variableScope:fstapi.c:2725
variableScope:fstapi.c:2726
variableScope:fstapi.c:2727
variableScope:fstapi.c:2728
variableScope:fstapi.c:2729
variableScope:fstapi.c:2730
variableScope:fstapi.c:2731
variableScope:fstapi.c:2732
variableScope:fstapi.c:2733
variableScope:fstapi.c:2736
variableScope:fstapi.c:2833
variableScope:fstapi.c:2836
variableScope:fstapi.c:3065
variableScope:fstapi.c:3107
variableScope:fstapi.c:3108
variableScope:fstapi.c:3708
variableScope:fstapi.c:3711
variableScope:fstapi.c:3875
variableScope:fstapi.c:3877
variableScope:fstapi.c:3878
variableScope:fstapi.c:4423
variableScope:fstapi.c:4424
variableScope:fstapi.c:4427
variableScope:fstapi.c:4428
variableScope:fstapi.c:4435
variableScope:fstapi.c:4436
variableScope:fstapi.c:4685
variableScope:fstapi.c:4966
variableScope:fstapi.c:4969
variableScope:fstapi.c:5544
variableScope:fstapi.c:5547
variableScope:fstapi.c:5548
variableScope:fstapi.c:5717
variableScope:fstapi.c:5777
variableScope:fstapi.c:6075
variableScope:fstapi.c:6078
variableScope:fstapi.c:6366
variableScope:fstapi.c:6445
variableScope:fstapi.c:6446
variableScope:fstapi.c:6472
variableScope:fstapi.c:6711
variableScope:fstapi.c:6933
variableScope:fstapi.c:6934
variableScope:fstapi.c:6935
asctimeCalled:fstapi.c
badBitmaskCheck:fstapi.c
constParameterPointer:fstapi.c
constVariablePointer:fstapi.c
duplicateConditionalAssign:fstapi.c
knownConditionTrueFalse:fstapi.c
memleak:fstapi.c
missingInclude:fst_win_unistd.h:50
nullPointer:fstapi.c
shiftTooManyBits:fstapi.c
shiftTooManyBitsSigned:fstapi.c
staticFunction:fstapi.c
uninitvar:fstapi.c
unreadVariable:fstapi.c
uselessAssignmentPtrArg:fstapi.c
variableScope:fstapi.c
// These functions are not used by Icarus
// fstReaderClrFacProcessMask()
unusedFunction:fstapi.c:3513
@ -205,24 +162,12 @@ unusedFunction:fstapi.c:2434
unusedFunction:fstapi.c:2352
// lxt2_write.c from GTKWave
allocaCalled:lxt2_write.c:1813
allocaCalled:lxt2_write.c:1819
knownConditionTrueFalse:lxt2_write.c:899
shiftNegativeLHS:lxt2_write.c:315
shiftNegativeLHS:lxt2_write.c:316
shiftNegativeLHS:lxt2_write.c:317
shiftNegativeLHS:lxt2_write.c:1935
variableScope:lxt2_write.c:33
variableScope:lxt2_write.c:63
variableScope:lxt2_write.c:196
variableScope:lxt2_write.c:463
variableScope:lxt2_write.c:464
variableScope:lxt2_write.c:523
variableScope:lxt2_write.c:581
variableScope:lxt2_write.c:587
variableScope:lxt2_write.c:1157
variableScope:lxt2_write.c:1613
variableScope:lxt2_write.c:2060
allocaCalled:lxt2_write.c
constParameterPointer:lxt2_write.c
knownConditionTrueFalse:lxt2_write.c
shiftNegativeLHS:lxt2_write.c
staticFunction:lxt2_write.c
variableScope:lxt2_write.c
// These functions are not used by Icarus
// lxt2_wr_emit_value_int()
unusedFunction:lxt2_write.c:1611
@ -246,7 +191,10 @@ unusedFunction:lxt2_write.c:1581
unusedFunction:lxt2_write.c:877
// lxt_write.c from GTKWave
knownConditionTrueFalse:lxt_write.c:1299
constParameterCallback:lxt_write.c
constParameterPointer:lxt_write.c
constVariablePointer:lxt_write.c
knownConditionTrueFalse:lxt_write.c
shiftNegative:lxt_write.c:2700
shiftNegative:lxt_write.c:2744
variableScope:lxt_write.c:31
@ -295,9 +243,9 @@ unusedFunction:lxt_write.c:1585
unusedFunction:lxt_write.c:1277
// fastlz.c from GTKWave
unreadVariable:fastlz.c:423
unusedLabel:fastlz.c:545
constVariablePointer:fastlz.c
syntaxError:fastlz.c
unreadVariable:fastlz.c
// These functions are not used by Icarus
// fastlz_compress_level()
unusedFunction:fastlz.c:152
@ -307,66 +255,80 @@ unusedFunction:fastlz.c:164
unusedFunction:fastlz.c:418
// lz4.c from GTKWave
unusedStructMember:lz4.c:140
bitwiseOnBoolean:lz4.c
constVariablePointer:lz4.c
staticFunction:lz4.c
syntaxError:lz4.c
unusedStructMember:lz4.c
// These functions are not used by Icarus
// LZ4_compress_continue()
unusedFunction:lz4.c:1465
// LZ4_compress_destSize()
unusedFunction:lz4.c:917
// LZ4_compress_fast_force()
unusedFunction:lz4.c:710
// LZ4_compress_forceExtDict()
unusedFunction:lz4.c:1068
// LZ4_compress_limitedOutput()
unusedFunction:lz4.c:1460
// LZ4_compress_limitedOutput_continue()
unusedFunction:lz4.c:1464
// LZ4_compress_limitedOutput_withState()
unusedFunction:lz4.c:1462
// LZ4_compress_withState()
unusedFunction:lz4.c:1463
// LZ4_create()
unusedFunction:lz4.c:1494
// LZ4_createStream()
unusedFunction:lz4.c:940
// LZ4_createStreamDecode()
unusedFunction:lz4.c:1324
// LZ4_decompress_fast_continue()
unusedFunction:lz4.c:1389
// LZ4_decompress_fast_usingDict()
unusedFunction:lz4.c:1444
// LZ4_decompress_fast_withPrefix64k()
unusedFunction:lz4.c:1515
// LZ4_decompress_safe_continue()
unusedFunction:lz4.c:1360
// LZ4_decompress_safe_forceExtDict()
unusedFunction:lz4.c:1450
// LZ4_decompress_safe_usingDict()
unusedFunction:lz4.c:1439
// LZ4_decompress_safe_withPrefix64k()
unusedFunction:lz4.c:1510
// LZ4_freeStream()
unusedFunction:lz4.c:953
// LZ4_freeStreamDecode()
unusedFunction:lz4.c:1330
// LZ4_loadDict()
unusedFunction:lz4.c:961
// LZ4_resetStreamState()
unusedFunction:lz4.c:1487
// LZ4_setStreamDecode()
unusedFunction:lz4.c:1343
// LZ4_sizeofState()
unusedFunction:lz4.c:378
// LZ4_sizeofStreamState()
unusedFunction:lz4.c:1479
// LZ4_slideInputBuffer()
unusedFunction:lz4.c:1501
// LZ4_uncompress()
unusedFunction:lz4.c:1473
// LZ4_uncompress_unknownOutputSize()
unusedFunction:lz4.c:1474
// LZ4_versionNumber()
unusedFunction:lz4.c:376
unusedFunction:lz4.c:746
// LZ4_versionString()
unusedFunction:lz4.c:747
// LZ4_sizeofState()
unusedFunction:lz4.c:749
// LZ4_compress_fast_extState_fastReset()
unusedFunction:lz4.c:1411
// LZ4_compress_destSize_extState()
unusedFunction:lz4.c:1494
// LZ4_compress_destSize()
unusedFunction:lz4.c:1503
// LZ4_resetStream_fast()
unusedFunction:lz4.c:1567
// LZ4_resetStream()
unusedFunction:lz4.c:1572
// LZ4_loadDict()
unusedFunction:lz4.c:1583
// LZ4_attach_dictionary()
unusedFunction:lz4.c:1626
// LZ4_compress_forceExtDict()
unusedFunction:lz4.c:1755
// LZ4_saveDict()
unusedFunction:lz4.c:1782
// LZ4_decompress_fast_withPrefix64k()
unusedFunction:lz4.c:2456
// LZ4_createStreamDecode()
unusedFunction:lz4.c:2529
// LZ4_freeStreamDecode()
unusedFunction:lz4.c:2535
// LZ4_setStreamDecode()
unusedFunction:lz4.c:2549
// LZ4_decoderRingBufferSize()
unusedFunction:lz4.c:2575
// LZ4_decompress_safe_continue()
unusedFunction:lz4.c:2591
// LZ4_decompress_fast_continue()
unusedFunction:lz4.c:2631
// LZ4_decompress_safe_usingDict()
unusedFunction:lz4.c:2679
// LZ4_decompress_safe_partial_usingDict()
unusedFunction:lz4.c:2694
// LZ4_decompress_fast_usingDict()
unusedFunction:lz4.c:2709
// LZ4_compress_limitedOutput()
unusedFunction:lz4.c:2724
// LZ4_compress()
unusedFunction:lz4.c:2728
// LZ4_compress_limitedOutput_withState()
unusedFunction:lz4.c:2732
// LZ4_compress_withState()
unusedFunction:lz4.c:2736
// LZ4_compress_limitedOutput_continue()
unusedFunction:lz4.c:2740
// LZ4_compress_continue()
unusedFunction:lz4.c:2744
// LZ4_uncompress()
unusedFunction:lz4.c:2755
// LZ4_uncompress_unknownOutputSize()
unusedFunction:lz4.c:2759
// LZ4_sizeofStreamState()
unusedFunction:lz4.c:2766
// LZ4_resetStreamState()
unusedFunction:lz4.c:2768
// LZ4_create()
unusedFunction:lz4.c:2776
// LZ4_slideInputBuffer()
unusedFunction:lz4.c:2783
// The routines in sys_random.c are exact copies from IEEE1364-2005 and
// they have scope warnings that we need to ignore.
@ -377,8 +339,19 @@ variableScope:sys_random.c:148
// Issues in Lex/Yacc files
allocaCalled:sdf_parse.c
constParameterPointer:sdf_parse.c
constVariablePointer:sdf_parse.c
knownConditionTrueFalse:sdf_parse.c
duplicateBreak:sdf_lexor.lex
duplicateBreak:sys_readmem_lex.lex
allocaCalled:table_mod_parse.c
constParameterPointer:table_mod_parse.c
constVariablePointer:table_mod_parse.c
knownConditionTrueFalse:table_mod_parse.c
duplicateBreak:table_mod_lexor.lex
constVariablePointer:<stdout>
duplicateBreak:<stdout>
nullPointer:<stdout>
redundantInitialization:<stdout>
staticFunction:<stdout>
unusedFunction:<stdout>

52
vpi/fst_win_unistd.h Normal file
View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2009-2018 Tony Bybell.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
*/
#ifndef WIN_UNISTD_H
#define WIN_UNISTD_H
#include <stdlib.h>
#ifdef _WIN64
#include <io.h>
#else
#include <sys/io.h>
#endif
#include <process.h>
#define ftruncate _chsize_s
#define unlink _unlink
#define fileno _fileno
#define lseek _lseeki64
#ifdef _WIN64
#define ssize_t __int64
#define SSIZE_MAX 9223372036854775807i64
#else
#define ssize_t long
#define SSIZE_MAX 2147483647L
#endif
#include "stdint.h"
#endif //WIN_UNISTD_H

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2026 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
@ -657,10 +657,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
case vpiNamedFork:
if (depth > 0) {
char *instname;
const char *instname;
char *defname = NULL;
/* list of types to iterate upon */
static int types[] = {
const static int types[] = {
/* Value */
vpiNamedEvent,
vpiNet,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2023 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2026 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
@ -36,7 +36,7 @@ PLI_UINT64 timerec_to_time64(const struct t_vpi_time*timerec)
return tmp;
}
char *as_escaped(char *arg)
char *as_escaped(const char *arg)
{
unsigned idx, cur, cnt, len = strlen(arg) + 1;
char *res = (char *) malloc(sizeof(char) * len);
@ -111,7 +111,7 @@ char* attach_suffix_to_filename(char *path, const char*suff)
{
/* If the name already has a suffix, then don't replace it or
add another suffix. Just return this path. */
char*tailp = strrchr(path, '.');
const char*tailp = strrchr(path, '.');
if (tailp != 0) return path;
/* The name doesn't have a suffix, so append the passed in

View File

@ -1,7 +1,7 @@
#ifndef IVL_sys_priv_H
#define IVL_sys_priv_H
/*
* Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2002-2026 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
@ -37,7 +37,7 @@ extern unsigned long genrand(struct context_s *context);
extern PLI_UINT64 timerec_to_time64(const struct t_vpi_time*timerec);
extern char *as_escaped(char *arg);
extern char *as_escaped(const char *arg);
extern char *get_filename(vpiHandle callh, const char *name, vpiHandle file);
extern char *get_filename_with_suffix(vpiHandle callh, const char*name,
vpiHandle file, const char*suff);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -955,7 +955,7 @@ void vvp_shiftl::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_vector4_t out (op_a_.size());
bool overflow_flag;
unsigned long shift;
unsigned long shift = 0;
if (! vector4_to_value(op_b_, overflow_flag, shift)) {
ptr.ptr()->send_vec4(x_val_, 0);
return;
@ -990,7 +990,7 @@ void vvp_shiftr::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_vector4_t out (op_a_.size());
bool overflow_flag;
unsigned long shift;
unsigned long shift = 0;
if (! vector4_to_value(op_b_, overflow_flag, shift)) {
ptr.ptr()->send_vec4(x_val_, 0);
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2026 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
@ -1445,6 +1445,9 @@ class array_word_part_callback : public array_word_value_callback {
explicit array_word_part_callback(p_cb_data data);
~array_word_part_callback() override;
array_word_part_callback(const array_word_part_callback&) = delete;
array_word_part_callback& operator=(const array_word_part_callback&) = delete;
bool test_value_callback_ready(void) override;
private:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2014-2026 Stephen Williams (steve@icarus.com)
* Copyright (c) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -70,17 +70,17 @@ struct __vpiArrayIndex : public __vpiHandle {
*/
struct __vpiArrayWord {
struct as_word_t : public __vpiHandle {
int get_type_code(void) const { return vpiMemoryWord; }
int vpi_get(int code);
char*vpi_get_str(int code);
void vpi_get_value(p_vpi_value vp);
vpiHandle vpi_put_value(p_vpi_value vp, int flags);
vpiHandle vpi_handle(int code);
int get_type_code(void) const override { return vpiMemoryWord; }
int vpi_get(int code) override;
char*vpi_get_str(int code) override;
void vpi_get_value(p_vpi_value vp) override;
vpiHandle vpi_put_value(p_vpi_value vp, int flags) override;
vpiHandle vpi_handle(int code) override;
} as_word;
struct as_index_t : public __vpiHandle {
int get_type_code(void) const { return vpiIndex; }
void vpi_get_value(p_vpi_value val);
int get_type_code(void) const override { return vpiIndex; }
void vpi_get_value(p_vpi_value val) override;
} as_index;
union {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -2028,13 +2028,13 @@ void compile_thread(char*start_sym, char*flag)
free(flag);
}
void compile_param_logic(char*label, char*name, char*value, bool signed_flag,
void compile_param_logic(char*label, const char*name, char*value, bool signed_flag,
bool local_flag,
long file_idx, long lineno)
{
vvp_vector4_t value4 = c4string_to_vector4(value);
vpiHandle obj = vpip_make_binary_param(name, value4, signed_flag,
local_flag, file_idx, lineno);
local_flag, file_idx, lineno);
compile_vpi_symbol(label, obj);
vpip_attach_to_current_scope(obj);
@ -2042,7 +2042,7 @@ void compile_param_logic(char*label, char*name, char*value, bool signed_flag,
free(value);
}
void compile_param_string(char*label, char*name, char*value,
void compile_param_string(char*label, const char*name, char*value,
bool local_flag,
long file_idx, long lineno)
{
@ -2054,7 +2054,7 @@ void compile_param_string(char*label, char*name, char*value,
free(label);
}
void compile_param_real(char*label, char*name, char*value,
void compile_param_real(char*label, const char*name, char*value,
bool local_flag,
long file_idx, long lineno)
{

View File

@ -1,7 +1,7 @@
#ifndef IVL_compile_H
#define IVL_compile_H
/*
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -282,13 +282,13 @@ extern void compile_timescale(long units, long precision);
extern void compile_vpi_symbol(const char*label, vpiHandle obj);
extern void compile_vpi_lookup(vpiHandle *objref, char*label);
extern void compile_param_string(char*label, char*name, char*value,
extern void compile_param_string(char*label, const char*name, char*value,
bool local_flag,
long file_idx, long lineno);
extern void compile_param_logic(char*label, char*name, char*value,
extern void compile_param_logic(char*label, const char*name, char*value,
bool signed_flag, bool local_flag,
long file_idx, long lineno);
extern void compile_param_real(char*label, char*name, char*value,
extern void compile_param_real(char*label, const char*name, char*value,
bool local_flag,
long file_idx, long lineno);
@ -316,6 +316,10 @@ class resolv_list_s {
next = NULL;
}
virtual ~resolv_list_s();
resolv_list_s(const resolv_list_s&) = delete;
resolv_list_s& operator=(const resolv_list_s&) = delete;
virtual bool resolve(bool mes = false) = 0;
protected:

View File

@ -1,38 +1,40 @@
// Skip the use STL messages
//useStlAlgorithm
// Skip all memory issues since they should be handled by ivl_alloc.h
ctunullpointerOutOfMemory
nullPointerArithmeticOutOfMemory
nullPointerOutOfMemory
// Skip strdup() not constant.
//constVariablePointer:main.cc:400
// Only for conditional debugging
knownConditionTrueFalse:lib_main.cc:289
// By convention we put statics at the top scope.
variableScope:vpi_priv.cc:623
// Index calculation
thisSubtraction:vpi_priv.h:430
thisSubtraction:array_common.h:91
// We use guarded memory allocation routines, but cppcheck is not
// noticing this so it is complaining we could return a NULL value.
nullPointerOutOfMemory:delay.cc:829 // calloc @ 828
nullPointerOutOfMemory:delay.cc:1252 // calloc @ 1251
nullPointerOutOfMemory:delay.cc:1253 // calloc @ 1251
nullPointerOutOfMemory:vpi_scope.cc:760 // calloc @ 757
nullPointerOutOfMemory:vpi_mcd.cc:68 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:69 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:75 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:76 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:77 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:78 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:79 // malloc @ 66
nullPointerOutOfMemory:vpi_mcd.cc:80 // malloc @ 66
nullPointerOutOfMemory:vpi_priv.cc:1090 // malloc @ 1089
nullPointerOutOfMemory:vpi_priv.cc:1102 // malloc @ 1101
nullPointerOutOfMemory:vpi_priv.cc:1112 // malloc @ 1111
nullPointerOutOfMemory:vpi_signal.cc:105 // strdup @ 623
nullPointerOutOfMemory:vpi_signal.cc:110 // strdup @ 109
nullPointerOutOfMemory:vpi_signal.cc:1380 // malloc @ 1379
nullPointerOutOfMemory:vpi_tasks.cc:577 // malloc @ 574
nullPointerOutOfMemory:vpi_tasks.cc:580 // malloc @ 574
ctunullpointerOutOfMemory:compile.cc:651 // strdup @ 1599 (vpi_signal.cc)
ctunullpointerOutOfMemory:stop.cc:489 // strdup @ 543
ctunullpointerOutOfMemory:vpi_signal.cc:105 // strdup @ 122 (vpi_bit.cc)
memleakOnRealloc:vpi_modules.cc:254
memleakOnRealloc:vpi_mcd.cc:316
memleakOnRealloc:vpi_signal.cc:1205
// The interface is from the standard.
constParameterCallback:vpi_priv.cc:1110
constParameterPointer:vpi_mcd.cc:158
// cppcheck is missing the code adds a \0 at the previous location.
knownConditionTrueFalse:vpi_modules.cc:118
redundantAssignment:vpi_modules.cc:117
// cppcheck does not undestand the format types match
invalidScanfArgType_int:compile.cc:597
invalidScanfArgType_int:compile.cc:603
invalidScanfArgType_int:compile.cc:609
invalidScanfArgType_int:vthread.cc:4545
invalidScanfArgType_int:vthread.cc:4548
invalidScanfArgType_int:vthread.cc:4551
invalidScanfArgType_int:vthread.cc:4554
// The new() operator is always used to allocate space for this class and
// pool is defined there.
@ -122,6 +124,15 @@ unusedFunction:vvp_net_sig.cc:128
// Unused functions from the lexor
duplicateBreak:lexor.lex
unusedFunction:lexor.cc
unusedStructMember:lexor.lex
constVariablePointer:lexor.cc
cstyleCast:lexor.cc
knownConditionTrueFalse:lexor.cc
nullPointer:lexor.cc
redundantInitialization:lexor.cc
unusedFunction:lexor.cc
unusedStructMember:lexor.cc
allocaCalled:parse.cc
constParameterPointer:parse.cc
constVariablePointer:parse.cc
knownConditionTrueFalse:parse.cc

View File

@ -4,7 +4,7 @@
%{
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -101,7 +101,7 @@ inline uint64_t strtouint64(const char*str, char**endptr, int base)
preceded by an 's' if the vector is signed. */
[1-9][0-9]*("'b"|"'sb")[01xz]+ {
yylval.vect.idx = strtoul(yytext, 0, 10);
yylval.vect.text = (char*)malloc(yylval.vect.idx + 2);
yylval.vect.text = static_cast<char*>(malloc(yylval.vect.idx + 2));
char*dest = yylval.vect.text;
const char*bits = strchr(yytext, '\'');

View File

@ -1,7 +1,7 @@
#ifndef IVL_symbols_H
#define IVL_symbols_H
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -57,6 +57,7 @@ class symbol_table_s {
public:
explicit symbol_table_s();
virtual ~symbol_table_s();
symbol_table_s& operator=(const symbol_table_s&) = delete;
// This method locates the value in the symbol table and sets its
// value. If the key doesn't yet exist, create it.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -233,6 +233,9 @@ class value_part_callback : public value_callback {
explicit value_part_callback(p_cb_data data);
~value_part_callback() override;
value_part_callback(const value_part_callback&) = delete;
value_part_callback& operator=(const value_part_callback&) = delete;
bool test_value_callback_ready(void) override;
private:
@ -400,6 +403,9 @@ class sync_callback : public __vpiCallback {
explicit sync_callback(p_cb_data data);
~sync_callback() override;
sync_callback(const sync_callback&) = delete;
sync_callback& operator=(const sync_callback&) = delete;
public:
// scheduled event
struct sync_cb* cb_sync;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -26,6 +26,7 @@
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <climits>
# include <cassert>
# include "ivl_alloc.h"
@ -245,7 +246,7 @@ void __vpiStringConst::vpi_get_value(p_vpi_value vp)
struct __vpiStringConstTEMP : public __vpiStringConst {
explicit inline __vpiStringConstTEMP(char*v) : __vpiStringConst(v) { }
free_object_fun_t free_object_fun(void);
free_object_fun_t free_object_fun(void) override;
};
static int free_temp_string(vpiHandle obj)
@ -270,25 +271,33 @@ vpiHandle vpip_make_string_const(char*text, bool persistent_flag)
class __vpiStringParam : public __vpiStringConst {
public:
__vpiStringParam(char*txt, const char*name);
__vpiStringParam(__vpiScope* scope, char*txt, const char*name,
bool local_flag, long file_idx, long lineno);
~__vpiStringParam() override;
int get_type_code(void) const override;
int vpi_get(int code) override;
char*vpi_get_str(int code) override;
vpiHandle vpi_handle(int code) override;
__vpiScope* scope;
bool local_flag;
unsigned file_idx;
unsigned lineno;
private:
__vpiScope* scope_;
const char*basename_;
bool local_flag_;
unsigned file_idx_;
unsigned lineno_;
};
inline __vpiStringParam::__vpiStringParam(char*txt, const char*nam)
inline __vpiStringParam::__vpiStringParam(__vpiScope* scope, char*txt, const char*nam,
bool local_flag, long file_idx, long lineno)
: __vpiStringConst(txt)
{
scope_ = scope;
basename_ = nam;
local_flag_ = local_flag;
assert(file_idx >= 0 && file_idx <= UINT_MAX);
file_idx_ = (unsigned) file_idx;
assert(lineno >= 0 && lineno <= UINT_MAX);
lineno_ = (unsigned) lineno;
}
__vpiStringParam::~__vpiStringParam()
@ -303,10 +312,10 @@ int __vpiStringParam::vpi_get(int code)
{
switch (code) {
case vpiLineNo :
return lineno;
return lineno_;
case vpiLocalParam :
return local_flag;
return local_flag_;
default :
return __vpiStringConst::vpi_get(code);
@ -317,10 +326,10 @@ int __vpiStringParam::vpi_get(int code)
char*__vpiStringParam::vpi_get_str(int code)
{
if (code == vpiFile) {
return simple_set_rbuf_str(file_names[file_idx]);
return simple_set_rbuf_str(file_names[file_idx_]);
}
return generic_get_str(code, scope, basename_, NULL);
return generic_get_str(code, scope_, basename_, NULL);
}
@ -328,10 +337,10 @@ vpiHandle __vpiStringParam::vpi_handle(int code)
{
switch (code) {
case vpiScope:
return scope;
return scope_;
case vpiModule:
return vpip_module(scope);
return vpip_module(scope_);
default:
return 0;
@ -341,11 +350,8 @@ vpiHandle __vpiStringParam::vpi_handle(int code)
vpiHandle vpip_make_string_param(const char*name, char*text,
bool local_flag, long file_idx, long lineno)
{
__vpiStringParam*obj = new __vpiStringParam(text, name);
obj->scope = vpip_peek_current_scope();
obj->local_flag = local_flag;
obj->file_idx = (unsigned) file_idx;
obj->lineno = (unsigned) lineno;
__vpiStringParam*obj = new __vpiStringParam(vpip_peek_current_scope(), text, name,
local_flag, file_idx, lineno);
return obj;
}
@ -464,25 +470,36 @@ vvp_vector4_t vector4_from_text(const char*bits, unsigned wid)
}
struct __vpiBinaryParam : public __vpiBinaryConst {
__vpiBinaryParam(const vvp_vector4_t&b, char*name);
__vpiBinaryParam(__vpiScope*scope, const vvp_vector4_t&b, bool is_signed,
const char*name, bool local_flag, long file_idx, long lineno);
~__vpiBinaryParam() override;
int get_type_code(void) const override;
int vpi_get(int code) override;
char*vpi_get_str(int code) override;
vpiHandle vpi_handle(int code) override;
__vpiScope*scope;
unsigned file_idx;
unsigned lineno;
bool local_flag;
private:
char*basename_;
__vpiScope*scope_;
const char*basename_;
bool local_flag_;
unsigned file_idx_;
unsigned lineno_;
};
inline __vpiBinaryParam::__vpiBinaryParam(const vvp_vector4_t&b, char*nam)
inline __vpiBinaryParam::__vpiBinaryParam(__vpiScope*scope, const vvp_vector4_t&b,
bool is_signed, const char*nam,
bool local_flag, long file_idx, long lineno)
{
scope_ = scope;
bits = b;
signed_flag = is_signed ? 1 : 0;
sized_flag = 0;
basename_ = nam;
local_flag_ = local_flag;
assert(file_idx >= 0 && file_idx <= UINT_MAX);
file_idx_ = (unsigned) file_idx;
assert(lineno >= 0 && lineno <= UINT_MAX);
lineno_ = (unsigned) lineno;
}
__vpiBinaryParam::~__vpiBinaryParam()
@ -497,10 +514,10 @@ int __vpiBinaryParam::vpi_get(int code)
{
switch (code) {
case vpiLineNo :
return lineno;
return lineno_;
case vpiLocalParam :
return local_flag;
return local_flag_;
default :
return __vpiBinaryConst::vpi_get(code);
@ -510,9 +527,9 @@ int __vpiBinaryParam::vpi_get(int code)
char*__vpiBinaryParam::vpi_get_str(int code)
{
if (code == vpiFile)
return simple_set_rbuf_str(file_names[file_idx]);
return simple_set_rbuf_str(file_names[file_idx_]);
return generic_get_str(code, scope, basename_, NULL);
return generic_get_str(code, scope_, basename_, NULL);
}
@ -520,10 +537,10 @@ vpiHandle __vpiBinaryParam::vpi_handle(int code)
{
switch (code) {
case vpiScope:
return scope;
return scope_;
case vpiModule:
return vpip_module(scope);
return vpip_module(scope_);
default:
return 0;
@ -531,18 +548,13 @@ vpiHandle __vpiBinaryParam::vpi_handle(int code)
}
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits,
vpiHandle vpip_make_binary_param(const char*name, const vvp_vector4_t&bits,
bool signed_flag, bool local_flag,
long file_idx, long lineno)
{
struct __vpiBinaryParam*obj = new __vpiBinaryParam(bits, name);
obj->signed_flag = signed_flag? 1 : 0;
obj->sized_flag = 0;
obj->local_flag = local_flag;
obj->scope = vpip_peek_current_scope();
obj->file_idx = (unsigned) file_idx;
obj->lineno = (unsigned) lineno;
struct __vpiBinaryParam*obj = new __vpiBinaryParam(vpip_peek_current_scope(),
bits, signed_flag, name,
local_flag, file_idx, lineno);
return obj;
}
@ -691,26 +703,34 @@ vpiHandle vpip_make_real_const(double value)
}
struct __vpiRealParam : public __vpiRealConst {
__vpiRealParam(double val, const char*name);
__vpiRealParam(__vpiScope* scope, double val, const char*name,
bool local_flag, long file_idx, long lineno);
~__vpiRealParam() override;
int get_type_code(void) const override;
int vpi_get(int code) override;
char*vpi_get_str(int code) override;
vpiHandle vpi_handle(int code) override;
__vpiScope* scope;
bool local_flag;
unsigned file_idx;
unsigned lineno;
private:
__vpiScope* scope_;
const char*basename_;
bool local_flag_;
unsigned file_idx_;
unsigned lineno_;
};
inline __vpiRealParam::__vpiRealParam(double val, const char*name)
inline __vpiRealParam::__vpiRealParam(__vpiScope* scope, double val, const char*name,
bool local_flag, long file_idx, long lineno)
: __vpiRealConst(val)
{
scope_ = scope;
basename_ = name;
local_flag_ = local_flag;
assert(file_idx >= 0 && file_idx <= UINT_MAX);
file_idx_ = (unsigned) file_idx;
assert(lineno >= 0 && lineno <= UINT_MAX);
lineno_ = (unsigned) lineno;
}
__vpiRealParam::~__vpiRealParam()
@ -726,10 +746,10 @@ int __vpiRealParam::vpi_get(int code)
{
switch (code) {
case vpiLineNo :
return lineno;
return lineno_;
case vpiLocalParam :
return local_flag;
return local_flag_;
default :
return __vpiRealConst::vpi_get(code);
@ -739,19 +759,19 @@ int __vpiRealParam::vpi_get(int code)
char* __vpiRealParam::vpi_get_str(int code)
{
if (code == vpiFile)
return simple_set_rbuf_str(file_names[file_idx]);
return simple_set_rbuf_str(file_names[file_idx_]);
return generic_get_str(code, scope, basename_, NULL);
return generic_get_str(code, scope_, basename_, NULL);
}
vpiHandle __vpiRealParam::vpi_handle(int code)
{
switch (code) {
case vpiScope:
return scope;
return scope_;
case vpiModule:
return vpip_module(scope);
return vpip_module(scope_);
default:
return 0;
@ -762,13 +782,9 @@ vpiHandle __vpiRealParam::vpi_handle(int code)
vpiHandle vpip_make_real_param(const char*name, double value,
bool local_flag, long file_idx, long lineno)
{
struct __vpiRealParam*obj = new __vpiRealParam(value, name);
obj->scope = vpip_peek_current_scope();
obj->local_flag = local_flag;
obj->file_idx = (unsigned) file_idx;
obj->lineno = (unsigned) lineno;
struct __vpiRealParam*obj = new __vpiRealParam(vpip_peek_current_scope(),
value, name, local_flag,
file_idx, lineno);
return obj;
}

View File

@ -1,7 +1,7 @@
#ifndef IVL_vpi_priv_H
#define IVL_vpi_priv_H
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 Stephen Williams (steve@icarus.com)
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch)
*
* This source code is free software; you can redistribute it
@ -620,6 +620,10 @@ class __vpiNamedEvent : public __vpiHandle {
public:
__vpiNamedEvent(__vpiScope*scope, const char*name);
~__vpiNamedEvent() override;
__vpiNamedEvent(const __vpiNamedEvent&) = delete;
__vpiNamedEvent& operator=(const __vpiNamedEvent&) = delete;
int get_type_code(void) const override;
__vpiScope*get_scope(void) const { return scope_; }
int vpi_get(int code) override;
@ -974,7 +978,7 @@ struct __vpiBinaryConst : public __vpiHandle {
};
vpiHandle vpip_make_binary_const(unsigned wid, const char*bits);
vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits,
vpiHandle vpip_make_binary_param(const char*name, const vvp_vector4_t&bits,
bool signed_flag, bool local_flag,
long file_idx, long lineno);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2026 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
@ -3495,7 +3495,7 @@ bool of_IX_GETV(vthread_t thr, vvp_code_t cp)
vvp_vector4_t vec;
sig->vec4_value(vec);
bool overflow_flag;
uint64_t val;
uint64_t val = 0;
bool known_flag = vector4_to_value(vec, overflow_flag, val);
if (known_flag)

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_island_H
#define IVL_vvp_island_H
/*
* Copyright (c) 2008-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2026 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,6 +63,9 @@ class vvp_island : private vvp_gen_event_s {
vvp_island();
virtual ~vvp_island() override;
vvp_island(const vvp_island&) = delete;
vvp_island& operator=(const vvp_island&) = delete;
// Ports call this method to flag that something happened at
// the input. The island will use this to create an active
// event. The run_run() method will then be called by the

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_net_H
#define IVL_vvp_net_H
/*
* Copyright (c) 2004-2025 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2026 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
@ -1409,7 +1409,7 @@ class vvp_fun_force : public vvp_net_fun_t {
class vvp_fun_drive : public vvp_net_fun_t {
public:
vvp_fun_drive(unsigned str0 =6, unsigned str1 =6);
explicit vvp_fun_drive(unsigned str0 =6, unsigned str1 =6);
~vvp_fun_drive() override;
void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,