diff --git a/PGenerate.cc b/PGenerate.cc index 717b088c6..6a71dbacc 100644 --- a/PGenerate.cc +++ b/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 * 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: { diff --git a/cppcheck.sup b/cppcheck.sup index 840e30aa4..195b7e360 100644 --- a/cppcheck.sup +++ b/cppcheck.sup @@ -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 diff --git a/elab_sig.cc b/elab_sig.cc index 15013c9b8..c9758444f 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -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::const_iterator sample_name = enum_type_->names->begin(); netenum_t*use_enum = scope->enumeration_for_name(sample_name->name); sig->set_enumeration(use_enum); diff --git a/elaborate.cc b/elaborate.cc index db1726e85..d5b97cb51 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -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); diff --git a/expr_synth.cc b/expr_synth.cc index ba5562017..004d35265 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -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); } diff --git a/main.cc b/main.cc index 35453e6de..cfec17b81 100644 --- a/main.cc +++ b/main.cc @@ -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::const_iterator idx; diff --git a/net_nex_input.cc b/net_nex_input.cc index 800b798d2..712ef37b0 100644 --- a/net_nex_input.cc +++ b/net_nex_input.cc @@ -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; diff --git a/pform.cc b/pform.cc index 0a23a4647..5edddf785 100644 --- a/pform.cc +++ b/pform.cc @@ -355,7 +355,7 @@ void pform_bind_attributes(map&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*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) { diff --git a/pform_dump.cc b/pform_dump.cc index 1e2eba4a6..d0936f9e4 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -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 {