From c0888c1b0ffae3afea7d8c36e05db0fd18fd42e4 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 18 Nov 2020 21:03:23 -0500 Subject: [PATCH] Internals: Use newline instead of endl to avoid unneeded flush. --- include/verilated.cpp | 2 +- include/verilated_cov.cpp | 2 +- src/V3Ast.cpp | 10 ++--- src/V3AstNodes.cpp | 4 +- src/V3Cdc.cpp | 14 +++---- src/V3Changed.cpp | 5 +-- src/V3Config.cpp | 9 ++-- src/V3Const.cpp | 7 ++-- src/V3Delayed.cpp | 8 ++-- src/V3Error.cpp | 2 +- src/V3File.cpp | 13 +++--- src/V3Gate.cpp | 8 ++-- src/V3Graph.cpp | 4 +- src/V3GraphAcyc.cpp | 4 +- src/V3Hashed.cpp | 10 ++--- src/V3InstrCount.cpp | 2 +- src/V3LinkCells.cpp | 8 ++-- src/V3LinkDot.cpp | 56 ++++++++++++------------- src/V3Number.cpp | 2 +- src/V3Options.cpp | 3 +- src/V3Order.cpp | 20 ++++----- src/V3Partition.cpp | 2 +- src/V3PreProc.cpp | 2 +- src/V3StatsReport.cpp | 33 +++++++-------- src/V3String.cpp | 8 ++-- src/V3SymTable.h | 5 +-- src/V3TSP.cpp | 4 +- src/V3Task.cpp | 16 ++++---- src/V3Tristate.cpp | 2 +- src/V3Unroll.cpp | 5 +-- src/V3Waiver.cpp | 18 ++++---- src/V3Width.cpp | 24 +++++------ src/VlcPoint.h | 4 +- src/VlcTest.h | 4 +- src/VlcTop.cpp | 18 ++++---- src/verilog.y | 14 +++---- test_regress/t/t_dpi_accessors.cpp | 66 +++++++++++++++--------------- 37 files changed, 203 insertions(+), 215 deletions(-) diff --git a/include/verilated.cpp b/include/verilated.cpp index cd301f38b..9f3f23b64 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -1045,7 +1045,7 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf const char* pos = formatp; for (; *pos && !_vl_vsss_eof(fp, floc); ++pos) { // VL_DBG_MSGF("_vlscan fmt='"< 8) { os << indent << " "; dumpPtrs(os); } if (s_debugFileline >= 9) { os << fileline()->warnContextSecondary(); } if (maxDepth == 1) { - if (op1p() || op2p() || op3p() || op4p()) { os << indent << "1: ...(maxDepth)" << endl; } + if (op1p() || op2p() || op3p() || op4p()) os << indent << "1: ...(maxDepth)\n"; } else { for (const AstNode* nodep = op1p(); nodep; nodep = nodep->nextp()) { nodep->dumpTree(os, indent + "1:", maxDepth - 1); @@ -1127,9 +1127,9 @@ void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump, boo const std::unique_ptr logsp(V3File::new_ofstream(filename, append)); if (logsp->fail()) v3fatal("Can't write " << filename); *logsp << "Verilator Tree Dump (format 0x3900) from to " << endl; + *logsp << "> to \n"; if (editCountGbl() == editCountLast() && !(v3Global.opt.dumpTree() >= 9)) { - *logsp << endl; + *logsp << '\n'; *logsp << "No changes since last dump!\n"; } else { dumpTree(*logsp); @@ -1199,7 +1199,7 @@ void AstNode::v3errorEnd(std::ostringstream& str) const { std::ostringstream nsstr; nsstr << str.str(); if (debug()) { - nsstr << endl; + nsstr << '\n'; nsstr << "-node: "; const_cast(this)->dump(nsstr); nsstr << endl; diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index c620cb432..9ad9a58c1 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1397,7 +1397,7 @@ void AstTypeTable::dump(std::ostream& str) const { this->AstNode::dump(str); for (int i = 0; i < static_cast(AstBasicDTypeKwd::_ENUM_MAX); ++i) { if (AstBasicDType* subnodep = m_basicps[i]) { - str << endl; // Newline from caller, so newline first + str << '\n'; // Newline from caller, so newline first str << "\t\t" << std::setw(8) << AstBasicDTypeKwd(i).ascii(); str << " -> "; subnodep->dump(str); @@ -1407,7 +1407,7 @@ void AstTypeTable::dump(std::ostream& str) const { const DetailedMap& mapr = m_detailedMap; for (const auto& itr : mapr) { AstBasicDType* dtypep = itr.second; - str << endl; // Newline from caller, so newline first + str << '\n'; // Newline from caller, so newline first str << "\t\tdetailed -> "; dtypep->dump(str); } diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 891420e47..65e69ed04 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -150,7 +150,7 @@ private: } else { *m_ofp << " "; } - *m_ofp << nodep->prettyTypeName() << " " << endl; + *m_ofp << nodep->prettyTypeName() << "\n"; string lastPrefix = m_prefix; m_prefix = lastPrefix + "1:"; iterateAndNextNull(nodep->op1p()); @@ -292,7 +292,7 @@ private: told_file = true; std::cerr << V3Error::msgPrefix() << " See details in " << m_ofFilename << endl; } - *m_ofp << "%Warning-" << code.ascii() << ": " << nodep->fileline() << " " << msg << endl; + *m_ofp << "%Warning-" << code.ascii() << ": " << nodep->fileline() << " " << msg << '\n'; } void setNodeHazard(AstNode* nodep) { @@ -462,7 +462,7 @@ private: string front = pad(filelineWidth(), nodep->fileline()->ascii() + ":") + " " + prefix + " +- "; if (VN_IS(nodep, VarScope)) { - *m_ofp << front << "Variable: " << nodep->prettyName() << endl; + *m_ofp << front << "Variable: " << nodep->prettyName() << '\n'; } else { V3EmitV::verilogPrefixedTree(nodep, *m_ofp, prefix + " +- ", filelineWidth(), vertexp->srcDomainp(), true); @@ -509,7 +509,7 @@ private: string filename = v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + "__cdc_edges.txt"; const std::unique_ptr ofp(V3File::new_ofstream(filename)); if (ofp->fail()) v3fatal("Can't write " << filename); - *ofp << "Edge Report for " << v3Global.opt.prefix() << endl; + *ofp << "Edge Report for " << v3Global.opt.prefix() << '\n'; std::deque report; // Sort output by name for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp = itp->verticesNextp()) { @@ -536,7 +536,7 @@ private: V3EmitV::verilogForTree(vvertexp->dstDomainp(), os); } os << std::setw(0); - os << endl; + os << '\n'; report.push_back(os.str()); } } @@ -732,7 +732,7 @@ public: m_ofp = V3File::new_ofstream(filename); if (m_ofp->fail()) v3fatal("Can't write " << filename); m_ofFilename = filename; - *m_ofp << "CDC Report for " << v3Global.opt.prefix() << endl; + *m_ofp << "CDC Report for " << v3Global.opt.prefix() << '\n'; *m_ofp << "Each dump below traces logic from inputs/source flops to destination flop(s).\n"; *m_ofp << "First source logic is listed, then a variable that logic generates,\n"; @@ -745,7 +745,7 @@ public: if (false) { *m_ofp << "\nDBG-test-dumper\n"; V3EmitV::verilogPrefixedTree(nodep, *m_ofp, "DBG ", 40, nullptr, true); - *m_ofp << endl; + *m_ofp << '\n'; } } virtual ~CdcVisitor() override { diff --git a/src/V3Changed.cpp b/src/V3Changed.cpp index 6d80a0a7b..7cf53bdfa 100644 --- a/src/V3Changed.cpp +++ b/src/V3Changed.cpp @@ -117,10 +117,9 @@ private: "Unsupported: Can't detect more than " << cvtToStr(DETECTARRAY_MAX_INDEXES) << " array indexes (probably with UNOPTFLAT warning suppressed): " - << m_vscp->prettyName() << endl + << m_vscp->prettyName() << '\n' << m_vscp->warnMore() - << "... Could recompile with DETECTARRAY_MAX_INDEXES increased" - << endl); + << "... Could recompile with DETECTARRAY_MAX_INDEXES increased"); return; } m_statep->maybeCreateChgFuncp(); diff --git a/src/V3Config.cpp b/src/V3Config.cpp index d58608116..e37421159 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -405,7 +405,7 @@ void V3Config::addInline(FileLine* fl, const string& module, const string& ftask V3ConfigResolver::s().modules().at(module).setInline(on); } else { if (!on) { - fl->v3error("no_inline not supported for tasks" << endl); + fl->v3error("no_inline not supported for tasks"); } else { V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setNoInline(on); } @@ -416,15 +416,14 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas const string& var, AstAttrType attr, AstSenTree* sensep) { // Semantics: sensep only if public_flat_rw if ((attr != AstAttrType::VAR_PUBLIC_FLAT_RW) && sensep) { - sensep->v3error("sensitivity not expected for attribute" << endl); + sensep->v3error("sensitivity not expected for attribute"); return; } // Semantics: Most of the attributes operate on signals if (var.empty()) { if (attr == AstAttrType::VAR_ISOLATE_ASSIGNMENTS) { if (ftask.empty()) { - fl->v3error("isolate_assignments only applies to signals or functions/tasks" - << endl); + fl->v3error("isolate_assignments only applies to signals or functions/tasks"); } else { V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setIsolate(true); } @@ -437,7 +436,7 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setPublic(true); } } else { - fl->v3error("missing -signal" << endl); + fl->v3error("missing -signal"); } } else { V3ConfigModule& mod = V3ConfigResolver::s().modules().at(module); diff --git a/src/V3Const.cpp b/src/V3Const.cpp index b2370d1ce..b34485311 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1262,7 +1262,7 @@ private: AstNode* errorp = simvis.whyNotNodep(); if (!errorp) errorp = nodep; nodep->v3error("Expecting expression to be constant, but can't determine constant for " - << nodep->prettyTypeName() << endl + << nodep->prettyTypeName() << '\n' << errorp->warnOther() << "... Location of non-constant " << errorp->prettyTypeName() << ": " << simvis.whyNotMessage()); VL_DO_DANGLING(replaceZero(nodep), nodep); @@ -1930,8 +1930,9 @@ private: nodep->replaceWith(ifp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } else if (ifSameAssign(nodep)) { - UINFO(4, "IF({a}) ASSIGN({b},{c}) else ASSIGN({b},{d}) => ASSIGN({b}, {a}?{c}:{d})" - << endl); + UINFO( + 4, + "IF({a}) ASSIGN({b},{c}) else ASSIGN({b},{d}) => ASSIGN({b}, {a}?{c}:{d})\n"); AstNodeAssign* ifp = VN_CAST(nodep->ifsp(), NodeAssign); AstNodeAssign* elsep = VN_CAST(nodep->elsesp(), NodeAssign); ifp->unlinkFrBack(); diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index c2f80ca6d..e37f1d7f1 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -160,10 +160,10 @@ private: varrefp->varp()->v3warn( MULTIDRIVEN, "Signal has multiple driving blocks with different clocking: " - << varrefp->varp()->prettyNameQ() << endl - << varrefp->warnOther() << "... Location of first driving block" << endl - << varrefp->warnContextPrimary() << endl - << oldactivep->warnOther() << "... Location of other driving block" << endl + << varrefp->varp()->prettyNameQ() << '\n' + << varrefp->warnOther() << "... Location of first driving block\n" + << varrefp->warnContextPrimary() << '\n' + << oldactivep->warnOther() << "... Location of other driving block\n" << oldactivep->warnContextSecondary()); varrefp->varp()->user2(true); } diff --git a/src/V3Error.cpp b/src/V3Error.cpp index 84df9285f..e8f8c6e18 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -234,7 +234,7 @@ void V3Error::v3errorEnd(std::ostringstream& sstr, const string& locationStr) { s_describedWarnings = true; } if (s_errorCode.dangerous()) { - std::cerr << warnMore() << "*** See the manual before disabling this," << endl; + std::cerr << warnMore() << "*** See the manual before disabling this,\n"; std::cerr << warnMore() << "else you may end up with different sim results." << endl; } diff --git a/src/V3File.cpp b/src/V3File.cpp index 59a2236c0..0d1fc5986 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -159,12 +159,12 @@ inline void V3FileDependImp::writeDepend(const string& filename) { if (!i.target()) *ofp << i.filename() << " "; } - *ofp << endl; + *ofp << '\n'; if (v3Global.opt.makePhony()) { - *ofp << endl; + *ofp << '\n'; for (const DependFile& i : m_filenameList) { - if (!i.target()) *ofp << i.filename() << ":" << endl; + if (!i.target()) *ofp << i.filename() << ":\n"; } } } @@ -183,9 +183,8 @@ inline void V3FileDependImp::writeTimes(const string& filename, const string& cm string cmdline = stripQuotes(cmdlineIn); *ofp << "# DESCR" - << "IPTION: Verilator output: Timestamp data for --skip-identical. Delete at will." - << endl; - *ofp << "C \"" << cmdline << "\"" << endl; + << "IPTION: Verilator output: Timestamp data for --skip-identical. Delete at will.\n"; + *ofp << "C \"" << cmdline << "\"\n"; for (std::set::iterator iter = m_filenameList.begin(); iter != m_filenameList.end(); ++iter) { @@ -209,7 +208,7 @@ inline void V3FileDependImp::writeTimes(const string& filename, const string& cm *ofp << " " << std::setw(11) << iter->mstime(); *ofp << " " << std::setw(11) << iter->mnstime(); *ofp << " \"" << iter->filename() << "\""; - *ofp << endl; + *ofp << '\n'; } } diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index b0b7d0a20..25b45e040 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -810,10 +810,10 @@ void GateVisitor::warnSignals() { vscp->varp()->user2(true); // Warn only once per signal vscp->v3warn(SYNCASYNCNET, "Signal flopped as both synchronous and async: " - << vscp->prettyNameQ() << endl - << ap->warnOther() << "... Location of async usage" << endl - << ap->warnContextPrimary() << endl - << sp->warnOther() << "... Location of sync usage" << endl + << vscp->prettyNameQ() << '\n' + << ap->warnOther() << "... Location of async usage\n" + << ap->warnContextPrimary() << '\n' + << sp->warnOther() << "... Location of sync usage\n" << sp->warnContextSecondary()); } } diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index 8001d55b6..1e7216bfd 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -279,7 +279,7 @@ void V3Graph::dump(std::ostream& os) { for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp = vertexp->verticesNextp()) { os << "\tNode: " << vertexp->name(); if (vertexp->color()) os << " color=" << vertexp->color(); - os << endl; + os << '\n'; // Print edges for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) { dumpEdge(os, vertexp, edgep); @@ -296,7 +296,7 @@ void V3Graph::dumpEdge(std::ostream& os, V3GraphVertex* vertexp, V3GraphEdge* ed if (edgep->fromp() == vertexp) os << "-> " << edgep->top()->name(); if (edgep->top() == vertexp) os << "<- " << edgep->fromp()->name(); if (edgep->cutable()) os << " [CUTABLE]"; - os << endl; + os << '\n'; } } diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index 4eff24c30..dce97d011 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -59,7 +59,7 @@ private: typedef std::list OrigEdgeList; // List of orig edges, see also GraphAcyc's decl V3GraphEdge* origEdgep() const { OrigEdgeList* oEListp = static_cast(userp()); - if (!oEListp) v3fatalSrc("No original edge associated with acyc edge " << this << endl); + if (!oEListp) v3fatalSrc("No original edge associated with acyc edge " << this); return (oEListp->front()); } @@ -155,7 +155,7 @@ private: breakEdgep->cut(); OrigEdgeList* oEListp = static_cast(breakEdgep->userp()); if (!oEListp) { - v3fatalSrc("No original edge associated with cutting edge " << breakEdgep << endl); + v3fatalSrc("No original edge associated with cutting edge " << breakEdgep); } // The breakGraph edge may represent multiple real edges; cut them all for (const auto& origEdgep : *oEListp) { diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index e830f0ab7..a9600f699 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -172,19 +172,19 @@ void V3Hashed::dumpFile(const string& filename, bool tree) { if (it == end()) break; num_in_bucket++; } - *logp << "\n*** STATS:\n" << endl; + *logp << "\n*** STATS:\n\n"; *logp << " #InBucket Occurrences\n"; for (const auto& i : dist) { - *logp << " " << std::setw(9) << i.first << " " << std::setw(12) << i.second << endl; + *logp << " " << std::setw(9) << i.first << " " << std::setw(12) << i.second << '\n'; } - *logp << "\n*** Dump:\n" << endl; + *logp << "\n*** Dump:\n\n"; for (const auto& itr : *this) { if (lasthash != itr.first) { lasthash = itr.first; - *logp << " " << itr.first << endl; + *logp << " " << itr.first << '\n'; } - *logp << "\t" << itr.second << endl; + *logp << "\t" << itr.second << '\n'; // Dumping the entire tree may make nearly N^2 sized dumps, // because the nodes under this one may also be in the hash table! if (tree) itr.second->dumpTree(*logp, " "); diff --git a/src/V3InstrCount.cpp b/src/V3InstrCount.cpp index 5eb23fae9..894aceba4 100644 --- a/src/V3InstrCount.cpp +++ b/src/V3InstrCount.cpp @@ -284,7 +284,7 @@ private: ++m_depth; if (unsigned costPlus1 = nodep->user4()) { *m_osp << " " << indent() << "cost " << std::setw(6) << std::left << (costPlus1 - 1) - << " " << nodep << endl; + << " " << nodep << '\n'; iterateChildren(nodep); } --m_depth; diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index 73e688c3e..a5f8e78c7 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -78,7 +78,7 @@ void LinkCellsGraph::loopsMessageCb(V3GraphVertex* vertexp) { vvertexp->modp()->v3warn(E_UNSUPPORTED, "Unsupported: Recursive multiple modules (module instantiates " "something leading back to itself): " - << vvertexp->modp()->prettyNameQ() << endl + << vvertexp->modp()->prettyNameQ() << '\n' << V3Error::warnMore() << "... note: self-recursion (module instantiating itself " "directly) is supported."); @@ -482,10 +482,10 @@ private: || nodep->fileline()->warnIsOff(V3ErrorCode::MODDUP) || hierBlocks.find(nodep->name()) != hierBlocks.end())) { nodep->v3warn(MODDUP, "Duplicate declaration of module: " - << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << foundp->warnOther() - << "... Location of original declaration" << endl + << "... Location of original declaration\n" << foundp->warnContextSecondary()); } nodep->unlinkFrBack(); diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 5d07c5457..df155c683 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -180,7 +180,7 @@ public: // left side is what we will import into os << "\t" << samn << "\t" << it->first << " (" << it->first->nodep()->typeName() << ") <- " << it->second << " " - << it->second->nodep() << endl; + << it->second->nodep() << '\n'; } } } @@ -269,15 +269,15 @@ public: UINFO(4, "Var2 " << fnodep << endl); if (nodep->type() == fnodep->type()) { nodep->v3error("Duplicate declaration of " - << nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << fnodep->warnOther() << "... Location of original declaration\n" << fnodep->warnContextSecondary()); } else { nodep->v3error("Unsupported in C: " << ucfirst(nodeTextType(nodep)) << " has the same name as " - << nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodeTextType(fnodep) << ": " << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << fnodep->warnOther() << "... Location of original declaration\n" << fnodep->warnContextSecondary()); } @@ -481,7 +481,7 @@ public: ifacerefp->modportFileline()->v3error( "Modport not found under interface " << ifacerefp->prettyNameQ(ifacerefp->ifaceName()) << ": " - << ifacerefp->prettyNameQ(ifacerefp->modportName()) << endl + << ifacerefp->prettyNameQ(ifacerefp->modportName()) << '\n' << (suggest.empty() ? "" : ifacerefp->warnMore() + suggest)); } } @@ -1081,15 +1081,15 @@ class LinkDotFindVisitor : public AstNVisitor { if (didAnsiWarn++) ansiWarn = false; } nodep->v3error("Duplicate declaration of signal: " - << nodep->prettyNameQ() << endl + << nodep->prettyNameQ() << '\n' << (ansiWarn ? nodep->warnMore() + "... note: ANSI ports must have" " type declared with the I/O (IEEE " "1800-2017 23.2.2.2)\n" : "") - << nodep->warnContextPrimary() << endl + << nodep->warnContextPrimary() << '\n' << findvarp->warnOther() - << "... Location of original declaration" << endl + << "... Location of original declaration\n" << findvarp->warnContextSecondary()); // Combining most likely reduce other errors findvarp->combineType(nodep); @@ -1119,8 +1119,8 @@ class LinkDotFindVisitor : public AstNVisitor { && !foundp->nodep()->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)) { nodep->v3warn(VARHIDDEN, "Declaration of signal hides declaration in upper scope: " - << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << foundp->nodep()->warnOther() << "... Location of original declaration\n" << foundp->nodep()->warnContextSecondary()); @@ -1204,8 +1204,8 @@ class LinkDotFindVisitor : public AstNVisitor { if (foundp->parentp() == m_curSymp // Only when on same level && !foundp->imported()) { // and not from package nodep->v3error("Duplicate declaration of enum value: " - << nodep->prettyName() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyName() << '\n' + << nodep->warnContextPrimary() << '\n' << foundp->nodep()->warnOther() << "... Location of original declaration\n" << foundp->nodep()->warnContextSecondary()); @@ -1215,8 +1215,8 @@ class LinkDotFindVisitor : public AstNVisitor { && !foundp->nodep()->fileline()->warnIsOff(V3ErrorCode::VARHIDDEN)) { nodep->v3warn(VARHIDDEN, "Declaration of enum value hides declaration in upper scope: " - << nodep->prettyName() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyName() << '\n' + << nodep->warnContextPrimary() << '\n' << foundp->nodep()->warnOther() << "... Location of original declaration\n" << nodep->warnContextSecondary()); @@ -1417,8 +1417,8 @@ private: } else { if (refp->user4()) { nodep->v3error("Duplicate declaration of port: " - << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << refp->warnOther() << "... Location of original declaration\n" << refp->warnContextSecondary()); } @@ -1811,7 +1811,7 @@ private: LinkNodeMatcherVar()); nodep->v3error("Signal definition not found, and implicit disabled with " "`default_nettype: " - << nodep->prettyNameQ() << endl + << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } @@ -1822,7 +1822,7 @@ private: LinkNodeMatcherVar()); nodep->v3warn(IMPLICIT, "Signal definition not found, creating implicitly: " - << nodep->prettyNameQ() << endl + << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } } @@ -1876,8 +1876,8 @@ private: } void markAndCheckPinDup(AstNode* nodep, AstNode* refp, const char* whatp) { if (refp->user5p() && refp->user5p() != nodep) { - nodep->v3error("Duplicate " << whatp << " connection: " << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + nodep->v3error("Duplicate " << whatp << " connection: " << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << refp->user5p()->warnOther() << "... Location of original " << whatp << " connection\n" << refp->user5p()->warnContextSecondary()); @@ -1973,7 +1973,7 @@ private: : m_statep->suggestSymFlat(m_pinSymp, nodep->name(), LinkNodeMatcherVarIO())); nodep->v3error(ucfirst(whatp) - << " not found: " << nodep->prettyNameQ() << endl + << " not found: " << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } else if (AstVar* refp = VN_CAST(foundp->nodep(), Var)) { if (!refp->isIO() && !refp->isParam() && !refp->isIfaceRef()) { @@ -2327,7 +2327,7 @@ private: string suggest = m_statep->suggestSymFallback( m_ds.m_dotSymp, nodep->name(), VNodeMatcher()); nodep->v3error("Can't find definition of " - << expectWhat << ": " << nodep->prettyNameQ() << endl + << expectWhat << ": " << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } else { nodep->v3error("Can't find definition of " @@ -2605,14 +2605,14 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); return; } else { - nodep->v3error("Unsupported or unknown PLI call: " - << nodep->prettyNameQ() << endl); + nodep->v3error( + "Unsupported or unknown PLI call: " << nodep->prettyNameQ()); } } else { string suggest = m_statep->suggestSymFallback(dotSymp, nodep->name(), LinkNodeMatcherFTask()); nodep->v3error("Can't find definition of task/function: " - << nodep->prettyNameQ() << endl + << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } } else { @@ -2773,7 +2773,7 @@ private: m_curSymp, cpackagerefp->name(), LinkNodeMatcherClass{}); cpackagerefp->v3error( "Class to extend not found: " - << cpackagerefp->prettyNameQ() << endl + << cpackagerefp->prettyNameQ() << '\n' << (suggest.empty() ? "" : cpackagerefp->warnMore() + suggest)); } } @@ -2810,7 +2810,7 @@ private: if (!VN_IS(nodep->packagep(), Class) && !VN_IS(nodep->packagep(), Package)) { cpackagerefp->v3error( "'::' expected to reference a class/package but referenced " - << nodep->packagep()->prettyTypeName() << endl + << nodep->packagep()->prettyTypeName() << '\n' << cpackagerefp->warnMore() + "... Suggest '.' instead of '::'"); } } diff --git a/src/V3Number.cpp b/src/V3Number.cpp index cf6ef219b..551229f4e 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -227,7 +227,7 @@ void V3Number::V3NumberCreate(AstNode* nodep, const char* sourcep, FileLine* fl) if (product.bitsValue(width(), 4)) { // Overflowed static int warned = 0; v3error("Too many digits for " - << width() << " bit number: " << sourcep << std::endl + << width() << " bit number: " << sourcep << '\n' << ((!m_sized && !warned++) ? ( V3Error::warnMore() + "... As that number was unsized" + " ('d...) it is limited to 32 bits (IEEE 1800-2017 " diff --git a/src/V3Options.cpp b/src/V3Options.cpp index b8ec760e5..b388d8394 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -547,8 +547,7 @@ void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) { } else if (!shown_notfound_msg) { shown_notfound_msg = true; if (m_impp->m_incDirUsers.empty()) { - fl->v3error("This may be because there's no search path specified with -I." - << endl); + fl->v3error("This may be because there's no search path specified with -I."); } std::cerr << V3Error::warnMore() << "... Looked in:" << endl; for (const string& dir : m_impp->m_incDirUsers) { diff --git a/src/V3Order.cpp b/src/V3Order.cpp index baeda2cb1..7653e7054 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -113,7 +113,7 @@ static bool domainsExclusive(const AstSenTree* fromp, const AstSenTree* top); // Functions for above graph classes void OrderGraph::loopsVertexCb(V3GraphVertex* vertexp) { - if (debug()) cout << "-Info-Loop: " << vertexp << " " << endl; + if (debug()) cout << "-Info-Loop: " << vertexp << "\n"; if (OrderLogicVertex* vvertexp = dynamic_cast(vertexp)) { std::cerr << vvertexp->nodep()->fileline()->warnOther() << " Example path: " << vvertexp->nodep()->typeName() << endl; @@ -273,7 +273,7 @@ private: if (m_inClocked) { varrefp->v3warn( CLKDATA, "Clock used as data (on rhs of assignment) in sequential block " - << varrefp->prettyNameQ() << endl); + << varrefp->prettyNameQ()); } else { m_hasClk = true; UINFO(5, "node is already marked as clocker " << varrefp << endl); @@ -290,8 +290,8 @@ private: // do the marking if (m_hasClk) { if (nodep->lhsp()->width() > m_rightClkWidth) { - nodep->v3warn(CLKDATA, "Clock is assigned to part of data signal " << nodep->lhsp() - << endl); + nodep->v3warn(CLKDATA, + "Clock is assigned to part of data signal " << nodep->lhsp()); UINFO(4, "CLKDATA: lhs with width " << nodep->lhsp()->width() << endl); UINFO(4, " but rhs clock with width " << m_rightClkWidth << endl); return; // skip the marking @@ -870,7 +870,7 @@ private: m_graph.userClearVertices(); // May be very large vector, so only report the "most important" // elements. Up to 10 of the widest - std::cerr << V3Error::warnMore() << "... Widest candidate vars to split:" << endl; + std::cerr << V3Error::warnMore() << "... Widest candidate vars to split:\n"; std::stable_sort(m_unoptflatVars.begin(), m_unoptflatVars.end(), OrderVarWidthCmp()); std::unordered_set canSplitList; int lim = m_unoptflatVars.size() < 10 ? m_unoptflatVars.size() : 10; @@ -885,10 +885,10 @@ private: std::cerr << ", can split_var"; canSplitList.insert(varp); } - std::cerr << std::endl; + std::cerr << '\n'; } // Up to 10 of the most fanned out - std::cerr << V3Error::warnMore() << "... Most fanned out candidate vars to split:" << endl; + std::cerr << V3Error::warnMore() << "... Most fanned out candidate vars to split:\n"; std::stable_sort(m_unoptflatVars.begin(), m_unoptflatVars.end(), OrderVarFanoutCmp()); lim = m_unoptflatVars.size() < 10 ? m_unoptflatVars.size() : 10; for (int i = 0; i < lim; i++) { @@ -902,7 +902,7 @@ private: std::cerr << ", can split_var"; canSplitList.insert(varp); } - std::cerr << endl; + std::cerr << '\n'; } if (!canSplitList.empty()) { std::cerr << V3Error::warnMore() @@ -1573,9 +1573,9 @@ void OrderVisitor::processEdgeReport() { } } - *logp << "Signals and their clock domains:" << endl; + *logp << "Signals and their clock domains:\n"; stable_sort(report.begin(), report.end()); - for (const string& i : report) *logp << i << endl; + for (const string& i : report) *logp << i << '\n'; } void OrderVisitor::processMoveClear() { diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index afe723493..b927ad644 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -663,7 +663,7 @@ public: // Dump for (const LogicMTask* mtaskp : path) { - *osp << "begin mtask with cost " << mtaskp->cost() << endl; + *osp << "begin mtask with cost " << mtaskp->cost() << '\n'; for (VxList::const_iterator lit = mtaskp->vertexListp()->begin(); lit != mtaskp->vertexListp()->end(); ++lit) { const OrderLogicVertex* logicp = (*lit)->logicp(); diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 9a4250676..344b939c2 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -855,7 +855,7 @@ void V3PreProcImp::dumpDefines(std::ostream& os) { // No need to print "()" below as already part of params() if (!it->second.params().empty()) os << it->second.params(); if (!it->second.value().empty()) os << " " << it->second.value(); - os << endl; + os << '\n'; } } diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index 14ad340ea..e93491eec 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -39,13 +39,12 @@ class StatsReport { static StatColl s_allStats; ///< All statistics void header() { - os << "Verilator Statistics Report\n"; - os << endl; + os << "Verilator Statistics Report\n\n"; - os << "Information:" << endl; - os << " " << V3Options::version() << endl; - os << " Arguments: " << v3Global.opt.allArgsString() << endl; - os << endl; + os << "Information:\n"; + os << " " << V3Options::version() << '\n'; + os << " Arguments: " << v3Global.opt.allArgsString() << '\n'; + os << '\n'; } void sumit() { @@ -85,28 +84,26 @@ class StatsReport { } // Print organized by stage - os << "Global Statistics:\n"; - os << endl; + os << "Global Statistics:\n\n"; for (const auto& itr : byName) { const V3Statistic* repp = itr.second; if (repp->perf()) continue; os << " " << std::left << std::setw(maxWidth) << repp->name(); repp->dump(os); - os << endl; + os << '\n'; } - os << endl; + os << '\n'; // Print organized by stage - os << "Performance Statistics:\n"; - os << endl; + os << "Performance Statistics:\n\n"; for (const auto& itr : byName) { const V3Statistic* repp = itr.second; if (!repp->perf()) continue; os << " " << std::left << std::setw(maxWidth) << repp->name(); repp->dump(os); - os << endl; + os << '\n'; } - os << endl; + os << '\n'; } void stages() { @@ -136,7 +133,7 @@ class StatsReport { // Header os << " Stat " << std::left << std::setw(maxWidth - 5 - 2) << ""; for (const string& i : stages) os << " " << std::left << std::setw(9) << i; - os << endl; + os << '\n'; os << " -------- " << std::left << std::setw(maxWidth - 5 - 2) << ""; for (auto it = stages.begin(); it != stages.end(); ++it) { os << " " << std::left << std::setw(9) << "-------"; @@ -157,10 +154,10 @@ class StatsReport { if ((pos = commaName.find(',')) != string::npos) commaName.erase(pos); if (lastCommaName != commaName) { lastCommaName = commaName; - os << endl; + os << '\n'; } } - os << endl; + os << '\n'; col = 0; os << " " << std::left << std::setw(maxWidth) << repp->name(); } @@ -171,7 +168,7 @@ class StatsReport { repp->dump(os); col++; } - os << endl; + os << '\n'; } public: diff --git a/src/V3String.cpp b/src/V3String.cpp index d8d2c32cd..418101436 100644 --- a/src/V3String.cpp +++ b/src/V3String.cpp @@ -345,13 +345,13 @@ void VHashSha256::selfTestOne(const string& data, const string& data2, const str VHashSha256 digest(data); if (data2 != "") digest.insert(data2); if (VL_UNCOVERABLE(digest.digestHex() != exp)) { - std::cerr << "%Error: When hashing '" << data + data2 << "'" << endl // LCOV_EXCL_LINE - << " ... got=" << digest.digestHex() << endl // LCOV_EXCL_LINE + std::cerr << "%Error: When hashing '" << data + data2 << "'\n" // LCOV_EXCL_LINE + << " ... got=" << digest.digestHex() << '\n' // LCOV_EXCL_LINE << " ... exp=" << exp << endl; // LCOV_EXCL_LINE } if (VL_UNCOVERABLE(digest.digestSymbol() != exp64)) { - std::cerr << "%Error: When hashing '" << data + data2 << "'" << endl // LCOV_EXCL_LINE - << " ... got=" << digest.digestSymbol() << endl // LCOV_EXCL_LINE + std::cerr << "%Error: When hashing '" << data + data2 << "'\n" // LCOV_EXCL_LINE + << " ... got=" << digest.digestSymbol() << '\n' // LCOV_EXCL_LINE << " ... exp=" << exp64 << endl; // LCOV_EXCL_LINE } } diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 6fbdca71f..e77b982d7 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -72,7 +72,7 @@ public: os << " fallb=se" << cvtToHex(m_fallbackp); if (m_symPrefix != "") os << " symPrefix=" << m_symPrefix; os << " n=" << nodep(); - os << endl; + os << '\n'; if (VL_UNCOVERABLE(doneSymsr.find(this) != doneSymsr.end())) { os << indent << "| ^ duplicate, so no children printed\n"; // LCOV_EXCL_LINE } else { @@ -126,8 +126,7 @@ public: if (name != "" && m_idNameMap.find(name) != m_idNameMap.end()) { if (!V3Error::errorCount()) { // Else may have just reported warning if (debug() >= 9 || V3Error::debugDefault()) dump(cout, "- err-dump: ", 1); - entp->nodep()->v3fatalSrc("Inserting two symbols with same name: " << name - << endl); + entp->nodep()->v3fatalSrc("Inserting two symbols with same name: " << name); } } else { m_idNameMap.insert(make_pair(name, entp)); diff --git a/src/V3TSP.cpp b/src/V3TSP.cpp index b107530f8..07a6d9e84 100644 --- a/src/V3TSP.cpp +++ b/src/V3TSP.cpp @@ -346,10 +346,10 @@ public: os << "At " << nameComment << ", dumping graph. Keys:\n"; for (V3GraphVertex* vxp = verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { Vertex* tspvp = castVertexp(vxp); - os << " " << tspvp->key() << endl; + os << " " << tspvp->key() << '\n'; for (V3GraphEdge* edgep = tspvp->outBeginp(); edgep; edgep = edgep->outNextp()) { Vertex* neighborp = castVertexp(edgep->top()); - os << " has edge " << edgep->user() << " to " << neighborp->key() << endl; + os << " has edge " << edgep->user() << " to " << neighborp->key() << '\n'; } } } diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 574117607..8cb19bedb 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -146,11 +146,11 @@ public: if (!vxp->pure()) { nodep->v3warn( IMPURE, "Unsupported: External variable referenced by non-inlined function/task: " - << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << vxp->impureNode()->warnOther() << "... Location of the external reference: " - << vxp->impureNode()->prettyNameQ() << endl + << vxp->impureNode()->prettyNameQ() << '\n' << vxp->impureNode()->warnContextSecondary()); } // And, we need to check all tasks this task calls @@ -837,11 +837,11 @@ private: } else if (iter->second.second != dpiproto) { nodep->v3error( "Duplicate declaration of DPI function with different formal arguments: " - << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl - << nodep->warnMore() << "... New prototype: " << dpiproto << endl + << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' + << nodep->warnMore() << "... New prototype: " << dpiproto << '\n' << iter->second.first->warnOther() - << "... Original prototype: " << iter->second.second << endl + << "... Original prototype: " << iter->second.second << '\n' << iter->second.first->warnContextSecondary()); return true; } else { @@ -862,7 +862,7 @@ private: portp->v3warn( E_UNSUPPORTED, "Unsupported: DPI argument of type " - << portp->basicp()->prettyTypeName() << endl + << portp->basicp()->prettyTypeName() << '\n' << portp->warnMore() << "... For best portability, use bit, byte, int, or longint"); // We don't warn on logic either, although the 4-stateness is lost. diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 7b1fa24d2..086ecbb30 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -449,7 +449,7 @@ class TristateVisitor : public TristateBaseVisitor { } else { if (oldpullp->direction() != pullp->direction()) { pullp->v3warn(E_UNSUPPORTED, "Unsupported: Conflicting pull directions.\n" - << pullp->warnContextPrimary() << endl + << pullp->warnContextPrimary() << '\n' << oldpullp->warnOther() << "... Location of conflicting pull.\n" << oldpullp->warnContextSecondary()); diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index 7a9c15e04..7a0165c15 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -118,11 +118,10 @@ private: m_forVarp = VN_CAST(initAssp->lhsp(), VarRef)->varp(); m_forVscp = VN_CAST(initAssp->lhsp(), VarRef)->varScopep(); if (VN_IS(nodep, GenFor) && !m_forVarp->isGenVar()) { - nodep->v3error("Non-genvar used in generate for: " // - << m_forVarp->prettyNameQ() << endl); + nodep->v3error("Non-genvar used in generate for: " << m_forVarp->prettyNameQ()); } else if (!VN_IS(nodep, GenFor) && m_forVarp->isGenVar()) { nodep->v3error("Genvar not legal in non-generate for (IEEE 1800-2017 27.4): " - << m_forVarp->prettyNameQ() << endl + << m_forVarp->prettyNameQ() << '\n' << nodep->warnMore() << "... Suggest move for loop upwards to generate-level scope."); } diff --git a/src/V3Waiver.cpp b/src/V3Waiver.cpp index 6cfa87687..31b6b9c86 100644 --- a/src/V3Waiver.cpp +++ b/src/V3Waiver.cpp @@ -34,20 +34,18 @@ void V3Waiver::write(const std::string& filename) { if (ofp->fail()) v3fatal("Can't write " << filename); *ofp << "// DESCR" - "IPTION: Verilator output: Waivers generated with --waiver-output" - << std::endl - << endl; + "IPTION: Verilator output: Waivers generated with --waiver-output\n\n"; - *ofp << "`verilator_config" << endl << endl; + *ofp << "`verilator_config\n\n"; - *ofp << "// Below you find suggested waivers. You have three options:" << endl; - *ofp << "// 1. Fix the reason for the linter warning" << endl; - *ofp << "// 2. Keep the waiver permanently if you are sure this is okay" << endl; - *ofp << "// 3. Keep the waiver temporarily to suppress the output" << endl << endl; + *ofp << "// Below you find suggested waivers. You have three options:\n"; + *ofp << "// 1. Fix the reason for the linter warning\n"; + *ofp << "// 2. Keep the waiver permanently if you are sure this is okay\n"; + *ofp << "// 3. Keep the waiver temporarily to suppress the output\n\n"; - if (s_waiverList.size() == 0) { *ofp << "// No waivers needed - great!" << endl; } + if (s_waiverList.empty()) *ofp << "// No waivers needed - great!\n"; - for (const auto& i : s_waiverList) *ofp << "// " << i << std::endl << endl; + for (const auto& i : s_waiverList) *ofp << "// " << i << "\n\n"; } V3Waiver::WaiverList V3Waiver::s_waiverList; diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 9e6c68ff8..17979e595 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1605,10 +1605,10 @@ private: virtual void visit(AstTypedef* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed if (auto* refp = checkRefToTypedefRecurse(nodep, nodep)) { - nodep->v3error("Typedef has self-reference: " << nodep->prettyNameQ() << endl - << nodep->warnContextPrimary() << endl + nodep->v3error("Typedef has self-reference: " << nodep->prettyNameQ() << '\n' + << nodep->warnContextPrimary() << '\n' << refp->warnOther() - << "... Location of reference" << endl + << "... Location of reference\n" << refp->warnContextSecondary()); // May cause internel error but avoids infinite loop on dump refp->typedefp(nullptr); @@ -1959,8 +1959,8 @@ private: if (inits.find(num) != inits.end()) { // IEEE says illegal AstNode* otherp = inits.find(num)->second; itemp->v3error("Overlapping enumeration value: " - << itemp->prettyNameQ() << endl - << itemp->warnContextPrimary() << endl + << itemp->prettyNameQ() << '\n' + << itemp->warnContextPrimary() << '\n' << otherp->warnOther() << "... Location of original declaration\n" << otherp->warnContextSecondary()); } else { @@ -2249,7 +2249,7 @@ private: } UINFO(1, "found object " << foundp << endl); nodep->v3fatalSrc("MemberSel of non-variable\n" - << nodep->warnContextPrimary() << endl + << nodep->warnContextPrimary() << '\n' << foundp->warnOther() << "... Location of found object\n" << foundp->warnContextSecondary()); } @@ -4079,7 +4079,7 @@ private: << " requires matching types;" << " ref requires " << pinDTypep->prettyDTypeNameQ() << " data type but connection is " - << conDTypep->prettyDTypeNameQ() << " data type." << endl); + << conDTypep->prettyDTypeNameQ() << " data type."); } else if (nodep->modVarp()->isTristate()) { if (pinwidth != conwidth) { nodep->v3warn(E_UNSUPPORTED, @@ -5411,9 +5411,7 @@ private: case AstType::atMulS: newp = new AstMul(fl, lhsp, rhsp); break; case AstType::atShiftR: newp = new AstShiftRS(fl, lhsp, rhsp); break; case AstType::atShiftRS: newp = new AstShiftR(fl, lhsp, rhsp); break; - default: - nodep->v3fatalSrc("Node needs sign change, but bad case: " << nodep << endl); - break; + default: nodep->v3fatalSrc("Node needs sign change, but bad case: " << nodep); break; } UINFO(6, " ReplaceWithUOrSVersion: " << nodep << " w/ " << newp << endl); nodep->replaceWith(newp); @@ -5451,7 +5449,7 @@ private: case AstType::atMul: case AstType::atMulS: newp = new AstMulD(fl, lhsp, rhsp); break; default: - nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep << endl); + nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep); break; } UINFO(6, " ReplaceWithDVersion: " << nodep << " w/ " << newp << endl); @@ -5483,7 +5481,7 @@ private: case AstType::atLte: case AstType::atLteS: newp = new AstLteN(fl, lhsp, rhsp); break; default: - nodep->v3fatalSrc("Node needs conversion to string, but bad case: " << nodep << endl); + nodep->v3fatalSrc("Node needs conversion to string, but bad case: " << nodep); break; } UINFO(6, " ReplaceWithNVersion: " << nodep << " w/ " << newp << endl); @@ -5502,7 +5500,7 @@ private: switch (nodep->type()) { case AstType::atNegate: newp = new AstNegateD(fl, lhsp); break; default: - nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep << endl); + nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep); break; } UINFO(6, " ReplaceWithDVersion: " << nodep << " w/ " << newp << endl); diff --git a/src/VlcPoint.h b/src/VlcPoint.h index ff88f00e0..e87c0de0f 100644 --- a/src/VlcPoint.h +++ b/src/VlcPoint.h @@ -77,13 +77,13 @@ public: } static void dumpHeader() { cout << "Points:\n"; - cout << " Num, TestsCover, Count, Name" << endl; + cout << " Num, TestsCover, Count, Name\n"; } void dump() const { cout << " " << std::setw(8) << std::setfill('0') << pointNum(); cout << ", " << std::setw(7) << std::setfill(' ') << testsCovering(); cout << ", " << std::setw(7) << std::setfill(' ') << count(); - cout << ", \"" << name() << "\"" << endl; + cout << ", \"" << name() << "\"\n"; } }; diff --git a/src/VlcTest.h b/src/VlcTest.h index c95e351d7..8db9a2059 100644 --- a/src/VlcTest.h +++ b/src/VlcTest.h @@ -65,7 +65,7 @@ public: static void dumpHeader() { cout << "Tests:\n"; // cout<<" Testrun, Computrons,"; // Currently not loaded - cout << " Covered, Rank, RankPts, Filename" << endl; + cout << " Covered, Rank, RankPts, Filename\n"; } void dump(bool bucketsToo) { if (testrun() || computrons() != 0.0) { // currently unused // LCOV_EXCL_LINE @@ -76,7 +76,7 @@ public: cout << " " << std::setw(7) << std::setfill(' ') << bucketsCovered(); cout << ", " << std::setw(7) << std::setfill(' ') << rank(); cout << ", " << std::setw(7) << std::setfill(' ') << rankPoints(); - cout << ", \"" << name() << "\"" << endl; + cout << ", \"" << name() << "\"\n"; if (bucketsToo) m_buckets.dump(); } }; diff --git a/src/VlcTop.cpp b/src/VlcTop.cpp index 4ff050d5f..ee7c57153 100644 --- a/src/VlcTop.cpp +++ b/src/VlcTop.cpp @@ -69,10 +69,10 @@ void VlcTop::writeCoverage(const string& filename) { return; } - os << "# SystemC::Coverage-3" << endl; + os << "# SystemC::Coverage-3\n"; for (const auto& i : m_points) { const VlcPoint& point = m_points.pointNumber(i.second); - os << "C '" << point.name() << "' " << point.count() << endl; + os << "C '" << point.name() << "' " << point.count() << '\n'; } } @@ -109,7 +109,7 @@ void VlcTop::writeInfo(const string& filename) { os << "TN:verilator_coverage\n"; for (auto& si : m_sources) { VlcSource& source = si.second; - os << "SF:" << source.name() << endl; + os << "SF:" << source.name() << '\n'; VlcSource::LinenoMap& lines = source.lines(); for (auto& li : lines) { int lineno = li.first; @@ -206,7 +206,7 @@ void VlcTop::annotateCalc() { unsigned thresh = (!threshStr.empty()) ? atoi(threshStr.c_str()) : opt.annotateMin(); bool ok = (point.count() >= thresh); UINFO(9, "AnnoCalc count " << filename << ":" << lineno << ":" << point.column() << " " - << point.count() << " " << point.linescov() << endl); + << point.count() << " " << point.linescov() << '\n'); // Base coverage source.incCount(lineno, point.column(), point.count(), ok); // Additional lines covered by this statement @@ -263,8 +263,8 @@ void VlcTop::annotateCalcNeeded() { } float pct = totCases ? (100 * totOk / totCases) : 0; cout << "Total coverage (" << totOk << "/" << totCases << ") "; - cout << std::fixed << std::setw(3) << std::setprecision(2) << pct << "%" << endl; - if (totOk != totCases) cout << "See lines with '%00' in " << opt.annotateOut() << endl; + cout << std::fixed << std::setw(3) << std::setprecision(2) << pct << "%\n"; + if (totOk != totCases) cout << "See lines with '%00' in " << opt.annotateOut() << '\n'; } void VlcTop::annotateOutputFiles(const string& dirname) { @@ -290,7 +290,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) { return; } - os << "\t// verilator_coverage annotation" << endl; + os << "\t// verilator_coverage annotation\n"; int lineno = 0; while (!is.eof()) { @@ -308,7 +308,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) { // UINFO(0,"Source // "<toUInt(), $7->toUInt()+1); } | vltOffFront yVLT_D_FILE yaSTRING yVLT_D_MATCH yaSTRING { if (($1==V3ErrorCode::I_COVERAGE) || ($1==V3ErrorCode::I_TRACING)) { - $1->v3error("Argument -match only supported for lint_off"<1->v3error("Argument -match only supported for lint_off"); } else { V3Config::addWaiver($1,*$3,*$5); }} @@ -6305,11 +6305,11 @@ vltOffFront: | yVLT_LINT_OFF { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_OFF yVLT_D_MSG idAny { $$ = V3ErrorCode((*$3).c_str()); - if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."<v3error("Unknown Error Code: " << *$3); } + $2->v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."); } | yVLT_LINT_OFF yVLT_D_RULE idAny { $$ = V3ErrorCode((*$3).c_str()); - if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3error("Unknown Error Code: " << *$3); } } ; vltOnFront: @@ -6318,11 +6318,11 @@ vltOnFront: | yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; } | yVLT_LINT_ON yVLT_D_MSG idAny { $$ = V3ErrorCode((*$3).c_str()); - if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."<v3error("Unknown Error Code: " << *$3); } + $2->v3warn(DEPRECATED, "Deprecated -msg in configuration files, use -rule instead."); } | yVLT_LINT_ON yVLT_D_RULE idAny { $$ = V3ErrorCode((*$3).c_str()); - if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<v3error("Unknown Error Code: " << *$3); } } ; vltDModuleE: diff --git a/test_regress/t/t_dpi_accessors.cpp b/test_regress/t/t_dpi_accessors.cpp index c5d7152d9..c20c81745 100644 --- a/test_regress/t/t_dpi_accessors.cpp +++ b/test_regress/t/t_dpi_accessors.cpp @@ -69,8 +69,8 @@ int main() { dut->eval(); #ifdef TEST_VERBOSE - cout << "Initial DPI values" << endl; - cout << "==================" << endl; + cout << "Initial DPI values\n"; + cout << "==================\n"; #endif int a = (int)a_read(); @@ -106,8 +106,8 @@ int main() { // Check we can read a scalar register. #ifdef TEST_VERBOSE - cout << "Test of scalar register reading" << endl; - cout << "===============================" << endl; + cout << "Test of scalar register reading\n"; + cout << "===============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -132,8 +132,8 @@ int main() { // Check we can read a vector register. #ifdef TEST_VERBOSE - cout << "Test of vector register reading" << endl; - cout << "===============================" << endl; + cout << "Test of vector register reading\n"; + cout << "===============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -156,8 +156,8 @@ int main() { // Test we can read an array element #ifdef TEST_VERBOSE cout << endl; - cout << "Test of array element reading" << endl; - cout << "=============================" << endl; + cout << "Test of array element reading\n"; + cout << "=============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -180,8 +180,8 @@ int main() { // Check we can read a scalar wire #ifdef TEST_VERBOSE cout << endl; - cout << "Test of scalar wire reading" << endl; - cout << "===========================" << endl; + cout << "Test of scalar wire reading\n"; + cout << "===========================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -209,8 +209,8 @@ int main() { // Check we can read a vector wire #ifdef TEST_VERBOSE cout << endl; - cout << "Test of vector wire reading" << endl; - cout << "===========================" << endl; + cout << "Test of vector wire reading\n"; + cout << "===========================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -239,8 +239,8 @@ int main() { // Check we can write a scalar register #ifdef TEST_VERBOSE cout << endl; - cout << "Test of scalar register writing" << endl; - cout << "===============================" << endl; + cout << "Test of scalar register writing\n"; + cout << "===============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -268,8 +268,8 @@ int main() { // Check we can write a vector register #ifdef TEST_VERBOSE cout << endl; - cout << "Test of vector register writing" << endl; - cout << "===============================" << endl; + cout << "Test of vector register writing\n"; + cout << "===============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -297,8 +297,8 @@ int main() { // Test we can write an array element #ifdef TEST_VERBOSE cout << endl; - cout << "Test of array element writing" << endl; - cout << "=============================" << endl; + cout << "Test of array element writing\n"; + cout << "=============================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -326,8 +326,8 @@ int main() { // Check we can read a vector register slice #ifdef TEST_VERBOSE cout << endl; - cout << "Test of vector register slice reading" << endl; - cout << "=====================================" << endl; + cout << "Test of vector register slice reading\n"; + cout << "=====================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -353,8 +353,8 @@ int main() { // Test we can read an array element slice #ifdef TEST_VERBOSE cout << endl; - cout << "Test of array element slice reading" << endl; - cout << "===================================" << endl; + cout << "Test of array element slice reading\n"; + cout << "===================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -382,8 +382,8 @@ int main() { // Check we can read a vector wire slice #ifdef TEST_VERBOSE cout << endl; - cout << "Test of vector wire slice reading" << endl; - cout << "=================================" << endl; + cout << "Test of vector wire slice reading\n"; + cout << "=================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -413,8 +413,8 @@ int main() { // Check we can write a vector register slice #ifdef TEST_VERBOSE cout << endl; - cout << "Test of vector register slice writing" << endl; - cout << "=====================================" << endl; + cout << "Test of vector register slice writing\n"; + cout << "=====================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -452,8 +452,8 @@ int main() { // Test we can write an array element slice #ifdef TEST_VERBOSE cout << endl; - cout << "Test of array element slice writing" << endl; - cout << "===================================" << endl; + cout << "Test of array element slice writing\n"; + cout << "===================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -497,8 +497,8 @@ int main() { // Check we can read complex registers #ifdef TEST_VERBOSE cout << endl; - cout << "Test of complex register reading" << endl; - cout << "================================" << endl; + cout << "Test of complex register reading\n"; + cout << "================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -577,8 +577,8 @@ int main() { // Test we can write a complex register #ifdef TEST_VERBOSE cout << endl; - cout << "Test of complex register writing" << endl; - cout << "================================" << endl; + cout << "Test of complex register writing\n"; + cout << "================================\n"; #endif for (int i = 0; !Verilated::gotFinish() && (i < 4); i++) { @@ -674,7 +674,7 @@ int main() { // Tidy up dut->final(); VL_DO_DANGLING(delete dut, dut); - cout << "*-* All Finished *-*" << endl; + cout << "*-* All Finished *-*\n"; } // Local Variables: