Some more cppcheck cleanup.
This patch cleans up most of the warnings in the main (ivl) directory.
This commit is contained in:
parent
c75d30455d
commit
4006bb2336
24
PGenerate.cc
24
PGenerate.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2010 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2006-2011 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -50,18 +50,18 @@ void PGenerate::probe_for_direct_nesting_(void)
|
||||||
// cannot be direct nested.
|
// cannot be direct nested.
|
||||||
if (scope_name[0] != '$') return;
|
if (scope_name[0] != '$') return;
|
||||||
|
|
||||||
if (tasks.size() > 0) return;
|
if (! tasks.empty()) return;
|
||||||
if (funcs.size() > 0) return;
|
if (! funcs.empty()) return;
|
||||||
if (gates.size() > 0) return;
|
if (! gates.empty()) return;
|
||||||
if (parameters.size() > 0) return;
|
if (! parameters.empty()) return;
|
||||||
if (localparams.size() > 0) return;
|
if (! localparams.empty()) return;
|
||||||
if (events.size() > 0) return;
|
if (! events.empty()) return;
|
||||||
if (wires.size() > 0) return;
|
if (! wires.empty()) return;
|
||||||
if (genvars.size() > 0) return;
|
if (! genvars.empty()) return;
|
||||||
if (behaviors.size() > 0) return;
|
if (! behaviors.empty()) return;
|
||||||
if (analog_behaviors.size() > 0) return;
|
if (! analog_behaviors.empty()) return;
|
||||||
|
|
||||||
if (generate_schemes.size() == 0) return;
|
if (generate_schemes.empty()) return;
|
||||||
|
|
||||||
switch (generate_schemes.size()) {
|
switch (generate_schemes.size()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
// These are correct and are used to find the base (zero) pin.
|
// These are correct and are used to find the base (zero) pin.
|
||||||
thisSubtraction:netlist.h:4165
|
thisSubtraction:netlist.h:4152
|
||||||
thisSubtraction:netlist.h:4174
|
thisSubtraction:netlist.h:4161
|
||||||
|
|
|
||||||
|
|
@ -1088,7 +1088,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
|
||||||
// If this is an enumeration, then set the enumeration set for
|
// If this is an enumeration, then set the enumeration set for
|
||||||
// the new signal. This turns it into an enumeration.
|
// the new signal. This turns it into an enumeration.
|
||||||
if (enum_type_) {
|
if (enum_type_) {
|
||||||
ivl_assert(*this, enum_type_->names->size() > 0);
|
ivl_assert(*this, ! enum_type_->names->empty());
|
||||||
list<named_pexpr_t>::const_iterator sample_name = enum_type_->names->begin();
|
list<named_pexpr_t>::const_iterator sample_name = enum_type_->names->begin();
|
||||||
netenum_t*use_enum = scope->enumeration_for_name(sample_name->name);
|
netenum_t*use_enum = scope->enumeration_for_name(sample_name->name);
|
||||||
sig->set_enumeration(use_enum);
|
sig->set_enumeration(use_enum);
|
||||||
|
|
|
||||||
|
|
@ -2307,7 +2307,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
st = event_->elaborate(des, scope);
|
st = event_->elaborate(des, scope);
|
||||||
st->set_line(*this);
|
|
||||||
if (st == 0) {
|
if (st == 0) {
|
||||||
cerr << event_->get_fileline() << ": error: "
|
cerr << event_->get_fileline() << ": error: "
|
||||||
"unable to elaborate event expression."
|
"unable to elaborate event expression."
|
||||||
|
|
@ -2315,6 +2314,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
des->errors += 1;
|
des->errors += 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
st->set_line(*this);
|
||||||
|
|
||||||
// If the expression is a constant, handle
|
// If the expression is a constant, handle
|
||||||
// certain special iteration counts.
|
// certain special iteration counts.
|
||||||
|
|
@ -2341,7 +2341,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
st = event_->elaborate_st(des, scope, a2);
|
st = event_->elaborate_st(des, scope, a2);
|
||||||
st->set_line(*this);
|
|
||||||
if (st == 0) {
|
if (st == 0) {
|
||||||
cerr << event_->get_fileline() << ": error: "
|
cerr << event_->get_fileline() << ": error: "
|
||||||
"unable to elaborate event expression."
|
"unable to elaborate event expression."
|
||||||
|
|
@ -2349,6 +2348,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
des->errors += 1;
|
des->errors += 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
st->set_line(*this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NetPDelay*de = new NetPDelay(delay, a2);
|
NetPDelay*de = new NetPDelay(delay, a2);
|
||||||
|
|
|
||||||
|
|
@ -1346,7 +1346,7 @@ NetNet* NetESFunc::synthesize(Design*des, NetScope*scope, NetExpr*root)
|
||||||
}
|
}
|
||||||
|
|
||||||
NetEvWait*trigger = 0;
|
NetEvWait*trigger = 0;
|
||||||
if (parms_.size() == 0) {
|
if (parms_.empty()) {
|
||||||
trigger = make_func_trigger(des, scope, root);
|
trigger = make_func_trigger(des, scope, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
main.cc
2
main.cc
|
|
@ -1164,7 +1164,7 @@ int main(int argc, char*argv[])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
errors_summary:
|
errors_summary:
|
||||||
if (missing_modules.size() > 0) {
|
if (! missing_modules.empty()) {
|
||||||
cerr << "*** These modules were missing:" << endl;
|
cerr << "*** These modules were missing:" << endl;
|
||||||
|
|
||||||
map<perm_string,unsigned>::const_iterator idx;
|
map<perm_string,unsigned>::const_iterator idx;
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ NexusSet* NetESelect::nex_input(bool rem_out)
|
||||||
*/
|
*/
|
||||||
NexusSet* NetESFunc::nex_input(bool rem_out)
|
NexusSet* NetESFunc::nex_input(bool rem_out)
|
||||||
{
|
{
|
||||||
if (parms_.size() == 0)
|
if (parms_.empty())
|
||||||
return new NexusSet;
|
return new NexusSet;
|
||||||
|
|
||||||
NexusSet*result;
|
NexusSet*result;
|
||||||
|
|
|
||||||
4
pform.cc
4
pform.cc
|
|
@ -355,7 +355,7 @@ void pform_bind_attributes(map<perm_string,PExpr*>&attributes,
|
||||||
if (attr == 0)
|
if (attr == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (attr->size() > 0) {
|
while (! attr->empty()) {
|
||||||
named_pexpr_t tmp = attr->front();
|
named_pexpr_t tmp = attr->front();
|
||||||
attr->pop_front();
|
attr->pop_front();
|
||||||
attributes[tmp.name] = tmp.parm;
|
attributes[tmp.name] = tmp.parm;
|
||||||
|
|
@ -2340,7 +2340,7 @@ extern PSpecPath* pform_assign_path_delay(PSpecPath*path, list<PExpr*>*del)
|
||||||
if (path == 0)
|
if (path == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
assert(path->delays.size() == 0);
|
assert(path->delays.empty());
|
||||||
|
|
||||||
path->delays.resize(del->size());
|
path->delays.resize(del->size());
|
||||||
for (unsigned idx = 0 ; idx < path->delays.size() ; idx += 1) {
|
for (unsigned idx = 0 ; idx < path->delays.size() ; idx += 1) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1998-2011 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -169,7 +169,7 @@ void PEConcat::dump(ostream&out) const
|
||||||
if (repeat_)
|
if (repeat_)
|
||||||
out << "{" << *repeat_;
|
out << "{" << *repeat_;
|
||||||
|
|
||||||
if (parms_.size() == 0) {
|
if (parms_.empty()) {
|
||||||
out << "{}";
|
out << "{}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ void PECallFunction::dump(ostream &out) const
|
||||||
{
|
{
|
||||||
out << path_ << "(";
|
out << path_ << "(";
|
||||||
|
|
||||||
if (parms_.size() > 0) {
|
if (! parms_.empty()) {
|
||||||
if (parms_[0]) parms_[0]->dump(out);
|
if (parms_[0]) parms_[0]->dump(out);
|
||||||
for (unsigned idx = 1; idx < parms_.size(); ++idx) {
|
for (unsigned idx = 1; idx < parms_.size(); ++idx) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
|
@ -478,7 +478,7 @@ void PGModule::dump(ostream&out, unsigned ind) const
|
||||||
out << setw(ind) << "" << type_ << " ";
|
out << setw(ind) << "" << type_ << " ";
|
||||||
|
|
||||||
// If parameters are overridden by order, dump them.
|
// If parameters are overridden by order, dump them.
|
||||||
if (overrides_ && overrides_->size() > 0) {
|
if (overrides_ && (! overrides_->empty())) {
|
||||||
assert(parms_ == 0);
|
assert(parms_ == 0);
|
||||||
out << "#(";
|
out << "#(";
|
||||||
|
|
||||||
|
|
@ -602,7 +602,7 @@ void PCallTask::dump(ostream&out, unsigned ind) const
|
||||||
{
|
{
|
||||||
out << setw(ind) << "" << path_;
|
out << setw(ind) << "" << path_;
|
||||||
|
|
||||||
if (parms_.size() > 0) {
|
if (! parms_.empty()) {
|
||||||
out << "(";
|
out << "(";
|
||||||
if (parms_[0])
|
if (parms_[0])
|
||||||
out << *parms_[0];
|
out << *parms_[0];
|
||||||
|
|
@ -638,7 +638,7 @@ void PCase::dump(ostream&out, unsigned ind) const
|
||||||
for (unsigned idx = 0 ; idx < items_->count() ; idx += 1) {
|
for (unsigned idx = 0 ; idx < items_->count() ; idx += 1) {
|
||||||
PCase::Item*cur = (*items_)[idx];
|
PCase::Item*cur = (*items_)[idx];
|
||||||
|
|
||||||
if (cur->expr.size() == 0) {
|
if (cur->expr.size()) {
|
||||||
out << setw(ind+2) << "" << "default:";
|
out << setw(ind+2) << "" << "default:";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue