Some more cppcheck cleanup.

This patch cleans up most of the warnings in the main (ivl) directory.
This commit is contained in:
Cary R 2011-04-18 18:17:16 -07:00 committed by Stephen Williams
parent c75d30455d
commit 4006bb2336
9 changed files with 28 additions and 28 deletions

View File

@ -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
* 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.
if (scope_name[0] != '$') return;
if (tasks.size() > 0) return;
if (funcs.size() > 0) return;
if (gates.size() > 0) return;
if (parameters.size() > 0) return;
if (localparams.size() > 0) return;
if (events.size() > 0) return;
if (wires.size() > 0) return;
if (genvars.size() > 0) return;
if (behaviors.size() > 0) return;
if (analog_behaviors.size() > 0) return;
if (! tasks.empty()) return;
if (! funcs.empty()) return;
if (! gates.empty()) return;
if (! parameters.empty()) return;
if (! localparams.empty()) return;
if (! events.empty()) return;
if (! wires.empty()) return;
if (! genvars.empty()) return;
if (! behaviors.empty()) return;
if (! analog_behaviors.empty()) return;
if (generate_schemes.size() == 0) return;
if (generate_schemes.empty()) return;
switch (generate_schemes.size()) {
case 1: {

View File

@ -1,3 +1,3 @@
// These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:4165
thisSubtraction:netlist.h:4174
thisSubtraction:netlist.h:4152
thisSubtraction:netlist.h:4161

View File

@ -1088,7 +1088,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
// If this is an enumeration, then set the enumeration set for
// the new signal. This turns it into an enumeration.
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();
netenum_t*use_enum = scope->enumeration_for_name(sample_name->name);
sig->set_enumeration(use_enum);

View File

@ -2307,7 +2307,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
return 0;
}
st = event_->elaborate(des, scope);
st->set_line(*this);
if (st == 0) {
cerr << event_->get_fileline() << ": error: "
"unable to elaborate event expression."
@ -2315,6 +2314,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
des->errors += 1;
return 0;
}
st->set_line(*this);
// If the expression is a constant, handle
// certain special iteration counts.
@ -2341,7 +2341,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
}
} else {
st = event_->elaborate_st(des, scope, a2);
st->set_line(*this);
if (st == 0) {
cerr << event_->get_fileline() << ": error: "
"unable to elaborate event expression."
@ -2349,6 +2348,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
des->errors += 1;
return 0;
}
st->set_line(*this);
}
} else {
NetPDelay*de = new NetPDelay(delay, a2);

View File

@ -1346,7 +1346,7 @@ NetNet* NetESFunc::synthesize(Design*des, NetScope*scope, NetExpr*root)
}
NetEvWait*trigger = 0;
if (parms_.size() == 0) {
if (parms_.empty()) {
trigger = make_func_trigger(des, scope, root);
}

View File

@ -1164,7 +1164,7 @@ int main(int argc, char*argv[])
return 0;
errors_summary:
if (missing_modules.size() > 0) {
if (! missing_modules.empty()) {
cerr << "*** These modules were missing:" << endl;
map<perm_string,unsigned>::const_iterator idx;

View File

@ -124,7 +124,7 @@ NexusSet* NetESelect::nex_input(bool rem_out)
*/
NexusSet* NetESFunc::nex_input(bool rem_out)
{
if (parms_.size() == 0)
if (parms_.empty())
return new NexusSet;
NexusSet*result;

View File

@ -355,7 +355,7 @@ void pform_bind_attributes(map<perm_string,PExpr*>&attributes,
if (attr == 0)
return;
while (attr->size() > 0) {
while (! attr->empty()) {
named_pexpr_t tmp = attr->front();
attr->pop_front();
attributes[tmp.name] = tmp.parm;
@ -2340,7 +2340,7 @@ extern PSpecPath* pform_assign_path_delay(PSpecPath*path, list<PExpr*>*del)
if (path == 0)
return 0;
assert(path->delays.size() == 0);
assert(path->delays.empty());
path->delays.resize(del->size());
for (unsigned idx = 0 ; idx < path->delays.size() ; idx += 1) {

View File

@ -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
* 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_)
out << "{" << *repeat_;
if (parms_.size() == 0) {
if (parms_.empty()) {
out << "{}";
return;
}
@ -190,7 +190,7 @@ void PECallFunction::dump(ostream &out) const
{
out << path_ << "(";
if (parms_.size() > 0) {
if (! parms_.empty()) {
if (parms_[0]) parms_[0]->dump(out);
for (unsigned idx = 1; idx < parms_.size(); ++idx) {
out << ", ";
@ -478,7 +478,7 @@ void PGModule::dump(ostream&out, unsigned ind) const
out << setw(ind) << "" << type_ << " ";
// If parameters are overridden by order, dump them.
if (overrides_ && overrides_->size() > 0) {
if (overrides_ && (! overrides_->empty())) {
assert(parms_ == 0);
out << "#(";
@ -602,7 +602,7 @@ void PCallTask::dump(ostream&out, unsigned ind) const
{
out << setw(ind) << "" << path_;
if (parms_.size() > 0) {
if (! parms_.empty()) {
out << "(";
if (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) {
PCase::Item*cur = (*items_)[idx];
if (cur->expr.size() == 0) {
if (cur->expr.size()) {
out << setw(ind+2) << "" << "default:";
} else {