diff --git a/Changes b/Changes index 9a77fd0f9..13dc1c06c 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks! * Verilator 4.000 devel +**** Fix internals to avoid 'using namespace std'. + * Verilator 3.921 devel diff --git a/src/V3Active.cpp b/src/V3Active.cpp index a797bb829..5966a2b69 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -66,7 +66,7 @@ private: AstScope* m_scopep; // Current scope to add statement to AstActive* m_iActivep; // For current scope, the IActive we're building AstActive* m_cActivep; // For current scope, the SActive(combo) we're building - vector m_activeVec; // List of sensitive actives, for folding + std::vector m_activeVec; // List of sensitive actives, for folding // METHODS void addActive(AstActive* nodep) { if (!m_scopep) nodep->v3fatalSrc("NULL scope"); @@ -119,7 +119,7 @@ public: // Not the fastest, but scopes tend to have few clocks AstActive* activep = NULL; //sitemsp->dumpTree(cout," Lookingfor: "); - for (vector::iterator it = m_activeVec.begin(); it!=m_activeVec.end(); ++it) { + for (std::vector::iterator it = m_activeVec.begin(); it!=m_activeVec.end(); ++it) { activep = *it; if (activep) { // Not deleted // Compare the list diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 8b8d7e863..2013fec2b 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -58,7 +58,7 @@ int AstNodeDType::s_uniqueNum = 0; //###################################################################### // V3AstType -ostream& operator<<(ostream& os, AstType rhs); +std::ostream& operator<<(std::ostream& os, AstType rhs); //###################################################################### // Creators @@ -417,7 +417,7 @@ void AstNode::replaceWith(AstNode* newp) { repHandle.relink(newp); } -void AstNRelinker::dump(ostream& str) const { +void AstNRelinker::dump(std::ostream& str) const { str<<" BK="<<(uint32_t*)m_backp; str<<" ITER="<<(uint32_t*)m_iterpp; str<<" CHG="<<(m_chg==RELINK_NEXT?"[NEXT] ":""); @@ -906,9 +906,9 @@ bool AstNode::sameTreeIter(AstNode* node1p, AstNode* node2p, bool ignNext, bool //====================================================================== // Static utilities -ostream& operator<<(ostream& os, const V3Hash& rhs) { - return os<8) { os<nextp()) { nodep->dumpTree(os, indent, maxDepth); @@ -1037,10 +1037,10 @@ void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump) { if (doDump) { { // Write log & close UINFO(2,"Dumping "< logsp (V3File::new_ofstream(filename, append)); + const vl_unique_ptr logsp (V3File::new_ofstream(filename, append)); if (logsp->fail()) v3fatalSrc("Can't write "<"; - *logsp<<" to "<"; + *logsp<<" to "<=9)) { *logsp<(this)) { // No known cases cause this, but better than a core dump if (debug()) UINFO(0, "-node: NULL. Please report this along with a --gdbbt backtrace as a Verilator bug.\n"); @@ -1071,7 +1071,7 @@ void AstNode::v3errorEnd(ostringstream& str) const { } else if (!m_fileline) { V3Error::v3errorEnd(str); } else { - ostringstream nsstr; + std::ostringstream nsstr; nsstr<::iterator it = m_deleteps.begin(); it != m_deleteps.end(); ++it) { + for (std::vector::iterator it = m_deleteps.begin(); it != m_deleteps.end(); ++it) { (*it)->deleteTree(); } m_deleteps.clear(); diff --git a/src/V3Ast.h b/src/V3Ast.h index 0f1a8556d..c98a7587d 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -61,7 +61,7 @@ public: inline bool operator== (AstType lhs, AstType rhs) { return (lhs.m_e == rhs.m_e); } inline bool operator== (AstType lhs, AstType::en rhs) { return (lhs.m_e == rhs); } inline bool operator== (AstType::en lhs, AstType rhs) { return (lhs == rhs.m_e); } - inline ostream& operator<<(ostream& os, const AstType& rhs) { return os<=1 && !m_littleEndian)); } - void dump(ostream& str) const { if (ranged()) str<<"["< m_deleteps; // Nodes to delete when doDeletes() called + std::vector m_deleteps; // Nodes to delete when doDeletes() called protected: friend class AstNode; public: @@ -932,9 +932,9 @@ public: AstNRelinker() { m_oldp=NULL; m_backp=NULL; m_chg=RELINK_BAD; m_iterpp=NULL;} void relink(AstNode* newp); AstNode* oldp() const { return m_oldp; } - void dump(ostream& str=cout) const; + void dump(std::ostream& str=std::cout) const; }; -inline ostream& operator<<(ostream& os, const AstNRelinker& rhs) { rhs.dump(os); return os;} +inline std::ostream& operator<<(std::ostream& os, const AstNRelinker& rhs) { rhs.dump(os); return os;} //###################################################################### // V3Hash -- Node hashing for V3Combine @@ -984,7 +984,7 @@ public: V3Hash(V3Hash h1, V3Hash h2, V3Hash h3, V3Hash h4) { setBoth(1,((h1.hshval()*31+h2.hshval())*31+h3.hshval())*31+h4.hshval()); } }; -ostream& operator<<(ostream& os, const V3Hash& rhs); +std::ostream& operator<<(std::ostream& os, const V3Hash& rhs); //###################################################################### // AstNode -- Base type of all Ast types @@ -1275,10 +1275,10 @@ public: AstBasicDType* findInsertSameDType(AstBasicDType* nodep); // METHODS - dump and error - void v3errorEnd(ostringstream& str) const; - void v3errorEndFatal(ostringstream& str) const VL_ATTR_NORETURN; + void v3errorEnd(std::ostringstream& str) const; + void v3errorEndFatal(std::ostringstream& str) const VL_ATTR_NORETURN; string warnMore() const; - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); void dumpGdb(); // For GDB only void dumpGdbHeader() const; @@ -1309,11 +1309,11 @@ public: void checkTree(); // User Interface version void checkIter() const; void clearIter() { m_iterpp=NULL; } - void dumpPtrs(ostream& str=cout) const; - void dumpTree(ostream& str=cout, const string& indent=" ", int maxDepth=0); + void dumpPtrs(std::ostream& str=std::cout) const; + void dumpTree(std::ostream& str=std::cout, const string& indent=" ", int maxDepth=0); void dumpTree(const string& indent, int maxDepth=0) { dumpTree(cout,indent,maxDepth); } void dumpTreeGdb(); // For GDB only - void dumpTreeAndNext(ostream& str=cout, const string& indent=" ", int maxDepth=0); + void dumpTreeAndNext(std::ostream& str=std::cout, const string& indent=" ", int maxDepth=0); void dumpTreeFile(const string& filename, bool append=false, bool doDump=true); static void dumpTreeFileGdb(const char* filenamep=NULL); @@ -1350,7 +1350,7 @@ public: // AstAlways* castAlways(); }; -inline ostream& operator<<(ostream& os, AstNode* rhs) { if (!rhs) os<<"NULL"; else rhs->dump(os); return os; } +inline std::ostream& operator<<(std::ostream& os, AstNode* rhs) { if (!rhs) os<<"NULL"; else rhs->dump(os); return os; } inline void AstNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); } //###################################################################### @@ -1687,7 +1687,7 @@ public: m_text = textp; // Copy it } ASTNODE_BASE_FUNCS(NodeText) - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual V3Hash sameHash() const { return V3Hash(text()); } virtual bool same(const AstNode* samep) const { const AstNodeText* asamep = static_cast(samep); @@ -1713,8 +1713,8 @@ public: } ASTNODE_BASE_FUNCS(NodeDType) // ACCESSORS - virtual void dump(ostream& str); - virtual void dumpSmall(ostream& str); + virtual void dump(std::ostream& str); + virtual void dumpSmall(std::ostream& str); virtual bool hasDType() const { return true; } virtual AstBasicDType* basicp() const = 0; // (Slow) recurse down to find basic data type virtual AstNodeDType* skipRefp() const = 0; // recurses over typedefs/const/enum to next non-typeref type @@ -1747,7 +1747,7 @@ public: bool generic() const { return m_generic; } void generic(bool flag) { m_generic = flag; } AstNodeDType* dtypeDimensionp(int depth); - pair dimensions(bool includeBasic); + std::pair dimensions(bool includeBasic); uint32_t arrayUnpackedElements(); // 1, or total multiplication of all dimensions static int uniqueNumInc() { return ++s_uniqueNum; } const char* charIQWN() const { return (isString() ? "N" : isWide() ? "W" : isQuad() ? "Q" : "I"); } @@ -1756,7 +1756,7 @@ public: class AstNodeClassDType : public AstNodeDType { private: // TYPES - typedef map MemberNameMap; + typedef std::map MemberNameMap; // MEMBERS bool m_packed; bool m_isFourstate; @@ -1771,7 +1771,7 @@ public: } ASTNODE_BASE_FUNCS(NodeClassDType) virtual const char* broken() const; - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); // For basicp() we reuse the size to indicate a "fake" basic type of same size virtual AstBasicDType* basicp() const { return (isFourstate() ? findLogicDType(width(),width(),numeric())->castBasicDType() @@ -1814,8 +1814,8 @@ public: m_refDTypep = NULL; } ASTNODE_BASE_FUNCS(NodeArrayDType) - virtual void dump(ostream& str); - virtual void dumpSmall(ostream& str); + virtual void dump(std::ostream& str); + virtual void dumpSmall(std::ostream& str); virtual const char* broken() const { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return NULL; } virtual void cloneRelink() { if (m_refDTypep && m_refDTypep->clonep()) { @@ -1911,7 +1911,7 @@ public: cname(name); // Might be overridden by dpi import/export } ASTNODE_BASE_FUNCS(NodeFTask) - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual string name() const { return m_name; } // * = Var name virtual bool maybePointedTo() const { return true; } virtual bool isGateOptimizable() const { return !((m_dpiExport || m_dpiImport) && !m_pure); } @@ -1977,7 +1977,7 @@ public: virtual void cloneRelink() { if (m_taskp && m_taskp->clonep()) { m_taskp = m_taskp->clonep(); }} - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual string name() const { return m_name; } // * = Var name virtual bool isGateOptimizable() const { return m_taskp && m_taskp->isGateOptimizable(); } string dotted() const { return m_dotted; } // * = Scope name or "" @@ -2025,7 +2025,7 @@ public: ,m_internal(false), m_recursive(false), m_recursiveClone(false) ,m_level(0), m_varNum(0), m_typeNum(0) { } ASTNODE_BASE_FUNCS(NodeModule) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual bool maybePointedTo() const { return true; } virtual string name() const { return m_name; } AstNode* stmtsp() const { return op2p(); } // op2 = List of statements diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 86eb804ae..246db14cb 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -504,7 +504,7 @@ uint32_t AstNodeDType::arrayUnpackedElements() { return entries; } -pair AstNodeDType::dimensions(bool includeBasic) { +std::pair AstNodeDType::dimensions(bool includeBasic) { // How many array dimensions (packed,unpacked) does this Var have? uint32_t packed = 0; uint32_t unpacked = 0; @@ -688,7 +688,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw if (kwd == AstBasicDTypeKwd::LOGIC) idx = IDX0_LOGIC; else if (kwd == AstBasicDTypeKwd::BIT) idx = IDX0_BIT; else fl->v3fatalSrc("Bad kwd for findLogicBitDType"); - pair widths = make_pair(width,widthMin); + std::pair widths = make_pair(width,widthMin); LogicMap& mapr = m_logicMap[idx][(int)numeric]; LogicMap::const_iterator it = mapr.find(widths); if (it != mapr.end()) return it->second; @@ -791,12 +791,12 @@ void AstWhile::addNextStmt(AstNode* newp, AstNode* belowp) { //====================================================================== // Per-type Debugging -void AstNode::dump(ostream& str) { +void AstNode::dump(std::ostream& str) { str<m_backp - <<" =editCountLast())?"#>":">") - <<" {"<filenameLetters()<lineno()<<"}"; + <<" {"<filenameLetters()<lineno()<<"}"; if (user1p()) str<<" u1="<<(void*)user1p(); if (user2p()) str<<" u2="<<(void*)user2p(); if (user3p()) str<<" u3="<<(void*)user3p(); @@ -817,45 +817,45 @@ void AstNode::dump(ostream& str) { } } -void AstAlways::dump(ostream& str) { +void AstAlways::dump(std::ostream& str) { this->AstNode::dump(str); if (keyword() != VAlwaysKwd::ALWAYS) str<<" ["<AstNode::dump(str); str<<" ["<AstNodeDType::dump(str); str<<" kwd="<AstNode::dump(str); str<<" sz"<AstNode::dump(str); if (recursive()) str<<" [RECURSIVE]"; if (modp()) { str<<" -> "; modp()->dump(str); } else { str<<" ->UNLINKED:"<AstNode::dump(str); str<<" -> "<AstNode::dump(str); //str<<" "<AstNode::dump(str); str<<" -> "; if (itemp()) { itemp()->dump(str); } else { str<<"UNLINKED"; } } -void AstIfaceRefDType::dump(ostream& str) { +void AstIfaceRefDType::dump(std::ostream& str) { this->AstNode::dump(str); if (cellName()!="") { str<<" cell="< "; ifacep()->dump(str); } else { str<<" -> UNLINKED"; } } -void AstIfaceRefDType::dumpSmall(ostream& str) { +void AstIfaceRefDType::dumpSmall(std::ostream& str) { this->AstNodeDType::dumpSmall(str); str<<"iface"; } -void AstJumpGo::dump(ostream& str) { +void AstJumpGo::dump(std::ostream& str) { this->AstNode::dump(str); str<<" -> "; if (labelp()) { labelp()->dump(str); } else { str<<"%Error:UNLINKED"; } } -void AstModportFTaskRef::dump(ostream& str) { +void AstModportFTaskRef::dump(std::ostream& str) { this->AstNode::dump(str); if (isExport()) str<<" EXPORT"; if (isImport()) str<<" IMPORT"; if (ftaskp()) { str<<" -> "; ftaskp()->dump(str); } else { str<<" -> UNLINKED"; } } -void AstModportVarRef::dump(ostream& str) { +void AstModportVarRef::dump(std::ostream& str) { this->AstNode::dump(str); str<<" "< "; varp()->dump(str); } else { str<<" -> UNLINKED"; } } -void AstPin::dump(ostream& str) { +void AstPin::dump(std::ostream& str) { this->AstNode::dump(str); if (modVarp()) { str<<" -> "; modVarp()->dump(str); } else { str<<" ->UNLINKED"; } if (svImplicit()) str<<" [.SV]"; } -void AstTypedef::dump(ostream& str) { +void AstTypedef::dump(std::ostream& str) { this->AstNode::dump(str); if (attrPublic()) str<<" [PUBLIC]"; } -void AstRange::dump(ostream& str) { +void AstRange::dump(std::ostream& str) { this->AstNode::dump(str); if (littleEndian()) str<<" [LITTLE]"; } -void AstRefDType::dump(ostream& str) { +void AstRefDType::dump(std::ostream& str) { this->AstNodeDType::dump(str); if (defp()) { str<<" -> "; defp()->dump(str); } else { str<<" -> UNLINKED"; } } -void AstNodeClassDType::dump(ostream& str) { +void AstNodeClassDType::dump(std::ostream& str) { this->AstNode::dump(str); if (packed()) str<<" [PACKED]"; if (isFourstate()) str<<" [4STATE]"; } -void AstNodeDType::dump(ostream& str) { +void AstNodeDType::dump(std::ostream& str) { this->AstNode::dump(str); if (generic()) str<<" [GENERIC]"; if (AstNodeDType* dtp = virtRefDTypep()) { @@ -919,7 +919,7 @@ void AstNodeDType::dump(ostream& str) { dtp->dumpSmall(str); } } -void AstNodeDType::dumpSmall(ostream& str) { +void AstNodeDType::dumpSmall(std::ostream& str) { str<<"(" <<(generic()?"G/":"") <<((isSigned()&&!isDouble())?"s":"") @@ -932,16 +932,16 @@ void AstNodeDType::dumpSmall(ostream& str) { if (!widthSized()) str<<"/"<AstNodeDType::dumpSmall(str); if (castPackArrayDType()) str<<"p"; else str<<"u"; str<AstNodeDType::dump(str); str<<" "<AstNode::dump(str); str<<" L"<AstNode::dump(str); str<<" -> "<AstNode::dump(str); str<<" -> "<AstNode::dump(str); if (declRange().ranged()) { str<<" decl"<AstNode::dump(str); if (declRange().ranged()) { str<<" decl"<AstNode::dump(str); for (int i=0; i<(int)(AstBasicDTypeKwd::_ENUM_MAX); ++i) { if (AstBasicDType* subnodep=m_basicps[i]) { str< "; subnodep->dump(str); } @@ -987,10 +987,10 @@ void AstTypeTable::dump(ostream& str) { for (LogicMap::const_iterator it = mapr.begin(); it != mapr.end(); ++it) { AstBasicDType* dtypep = it->second; str<first.first<<"/"<first.second; - str<<"\t\t"< "; dtypep->dump(str); @@ -1008,17 +1008,17 @@ void AstTypeTable::dump(ostream& str) { } // Note get newline from caller too. } -void AstUnsizedArrayDType::dumpSmall(ostream& str) { +void AstUnsizedArrayDType::dumpSmall(std::ostream& str) { this->AstNodeDType::dumpSmall(str); str<<"[]"; } -void AstVarScope::dump(ostream& str) { +void AstVarScope::dump(std::ostream& str) { this->AstNode::dump(str); if (isCircular()) str<<" [CIRC]"; if (varp()) { str<<" -> "; varp()->dump(str); } else { str<<" ->UNLINKED"; } } -void AstVarXRef::dump(ostream& str) { +void AstVarXRef::dump(std::ostream& str) { this->AstNode::dump(str); if (packagep()) { str<<" pkg="<<(void*)packagep(); } if (lvalue()) str<<" [LV] => "; @@ -1029,7 +1029,7 @@ void AstVarXRef::dump(ostream& str) { else if (varp()) { varp()->dump(str); } else { str<<"UNLINKED"; } } -void AstVarRef::dump(ostream& str) { +void AstVarRef::dump(std::ostream& str) { this->AstNode::dump(str); if (packagep()) { str<<" pkg="<<(void*)packagep(); } if (lvalue()) str<<" [LV] => "; @@ -1038,7 +1038,7 @@ void AstVarRef::dump(ostream& str) { else if (varp()) { varp()->dump(str); } else { str<<"UNLINKED"; } } -void AstVar::dump(ostream& str) { +void AstVar::dump(std::ostream& str) { this->AstNode::dump(str); if (isSc()) str<<" [SC]"; if (isPrimaryIO()) str<<(isInout()?" [PIO]":(isInput()?" [PI]":" [PO]")); @@ -1062,35 +1062,35 @@ void AstVar::dump(ostream& str) { if (!attrClocker().unknown()) str<<" ["<AstNode::dump(str); if (isMulti()) str<<" [MULTI]"; } -void AstSenItem::dump(ostream& str) { +void AstSenItem::dump(std::ostream& str) { this->AstNode::dump(str); str<<" ["<AstNode::dump(str); str<<" ["<AstNode::dump(str); if (packagep()) { str<<" pkg="<<(void*)packagep(); } str<<" -> "; if (packagep()) { packagep()->dump(str); } else { str<<"UNLINKED"; } } -void AstDot::dump(ostream& str) { +void AstDot::dump(std::ostream& str) { this->AstNode::dump(str); } -void AstActive::dump(ostream& str) { +void AstActive::dump(std::ostream& str) { this->AstNode::dump(str); str<<" => "; if (sensesp()) { sensesp()->dump(str); } else { str<<"UNLINKED"; } } -void AstNodeFTaskRef::dump(ostream& str) { +void AstNodeFTaskRef::dump(std::ostream& str) { this->AstNode::dump(str); if (packagep()) { str<<" pkg="<<(void*)packagep(); } str<<" -> "; @@ -1098,7 +1098,7 @@ void AstNodeFTaskRef::dump(ostream& str) { if (taskp()) { taskp()->dump(str); } else { str<<"UNLINKED"; } } -void AstNodeFTask::dump(ostream& str) { +void AstNodeFTask::dump(std::ostream& str) { this->AstNode::dump(str); if (taskPublic()) str<<" [PUBLIC]"; if (prototype()) str<<" [PROTOTYPE]"; @@ -1108,34 +1108,34 @@ void AstNodeFTask::dump(ostream& str) { if (dpiOpenParent()) str<<" [DPIOPENPARENT]"; if ((dpiImport() || dpiExport()) && cname()!=name()) str<<" [c="<AstNode::dump(str); if (unnamed()) str<<" [UNNAMED]"; if (generate()) str<<" [GEN]"; if (genforp()) str<<" [GENFOR]"; } -void AstCoverDecl::dump(ostream& str) { +void AstCoverDecl::dump(std::ostream& str) { this->AstNode::dump(str); if (this->dataDeclNullp()) { str<<" -> "; this->dataDeclNullp()->dump(str); } else { - if (binNum()) { str<<" bin"<AstNode::dump(str); str<<" -> "; if (declp()) { declp()->dump(str); } else { str<<"%Error:UNLINKED"; } } -void AstTraceInc::dump(ostream& str) { +void AstTraceInc::dump(std::ostream& str) { this->AstNode::dump(str); str<<" -> "; if (declp()) { declp()->dump(str); } else { str<<"%Error:UNLINKED"; } } -void AstNodeText::dump(ostream& str) { +void AstNodeText::dump(std::ostream& str) { this->AstNode::dump(str); string out = text(); string::size_type pos; @@ -1146,19 +1146,19 @@ void AstNodeText::dump(ostream& str) { str<<" \""<AstNode::dump(str); if (source()) str<<" [SRC]"; if (slow()) str<<" [SLOW]"; } -void AstCCall::dump(ostream& str) { +void AstCCall::dump(std::ostream& str) { this->AstNode::dump(str); if (funcp()) { str<<" "<name()<<" => "; funcp()->dump(str); } } -void AstCFunc::dump(ostream& str) { +void AstCFunc::dump(std::ostream& str) { this->AstNode::dump(str); if (slow()) str<<" [SLOW]"; if (pure()) str<<" [PURE]"; diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 7abdefd14..7a22a3bd0 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -140,7 +140,7 @@ public: int leftToRightInc() const { return littleEndian()?1:-1; } bool littleEndian() const { return m_littleEndian; } void littleEndian(bool flag) { m_littleEndian=flag; } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string emitC() { V3ERROR_NA; return ""; } virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode* samep) const { return true; } @@ -225,7 +225,7 @@ public: m_attrPublic = false; } ASTNODE_NODE_FUNCS(Typedef) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); AstNodeDType* getChildDTypep() const { return childDTypep(); } AstNodeDType* childDTypep() const { return op1p()->castNodeDType(); } // op1 = Type assigning to void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } @@ -370,7 +370,7 @@ public: const AstNodeArrayDType* asamep = static_cast(samep); return (subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp())); } - virtual void dumpSmall(ostream& str); + virtual void dumpSmall(std::ostream& str); virtual V3Hash sameHash() const { return V3Hash(m_refDTypep); } AstNodeDType* getChildDTypep() const { return childDTypep(); } AstNodeDType* childDTypep() const { return op1p()->castNodeDType(); } // op1 = Range of variable @@ -457,7 +457,7 @@ private: } public: ASTNODE_NODE_FUNCS(BasicDType) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual V3Hash sameHash() const { return V3Hash(V3Hash(m.m_keyword), V3Hash(m.m_nrange.hi())); } virtual bool same(const AstNode* samep) const { // width/widthMin/numeric compared elsewhere const AstBasicDType* sp = static_cast(samep); @@ -568,8 +568,8 @@ public: ASTNODE_NODE_FUNCS(IfaceRefDType) // METHODS virtual const char* broken() const; - virtual void dump(ostream& str=cout); - virtual void dumpSmall(ostream& str); + virtual void dump(std::ostream& str=std::cout); + virtual void dumpSmall(std::ostream& str); virtual void cloneRelink(); virtual AstBasicDType* basicp() const { return NULL; } virtual AstNodeDType* skipRefp() const { return (AstNodeDType*)this; } @@ -621,7 +621,7 @@ public: virtual bool similarDType(AstNodeDType* samep) const { return skipRefp()->similarDType(samep->skipRefp()); } virtual V3Hash sameHash() const { return V3Hash(V3Hash(m_refDTypep),V3Hash(m_packagep)); } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual string name() const { return m_name; } virtual AstBasicDType* basicp() const { return subDTypep() ? subDTypep()->basicp() : NULL; } virtual AstNodeDType* skipRefp() const { @@ -750,7 +750,7 @@ public: dtypeFrom(m_itemp); } ASTNODE_NODE_FUNCS(EnumItemRef) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return itemp()->name(); } virtual const char* broken() const { BROKEN_RTN(!itemp()); return NULL; } virtual int instrCount() const { return 0; } @@ -958,7 +958,7 @@ public: dtypeSetLogicSized(bitwidth,bitwidth,AstNumeric::UNSIGNED); } ASTNODE_NODE_FUNCS(Sel) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& bit, const V3Number& width) { out.opSel(from, bit.toUInt()+width.toUInt()-1, bit.toUInt()); } virtual string emitVerilog() { V3ERROR_NA; return ""; } // Implemented specially @@ -999,7 +999,7 @@ public: new AstConst(fl, declRange.elements())) , m_declRange(declRange) { } ASTNODE_NODE_FUNCS(SliceSel) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& lo, const V3Number& width) { V3ERROR_NA; } virtual string emitVerilog() { V3ERROR_NA; return ""; } // Implemented specially @@ -1170,7 +1170,7 @@ public: dtypeFrom(examplep); } ASTNODE_NODE_FUNCS(Var) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } // * = Var name virtual bool hasDType() const { return true; } virtual bool maybePointedTo() const { return true; } @@ -1427,7 +1427,7 @@ public: BROKEN_RTN(m_scopep && !m_scopep->brokeExists()); return NULL; } virtual bool maybePointedTo() const { return true; } virtual string name() const {return scopep()->name()+"->"+varp()->name();} // * = Var name - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual bool hasDType() const { return true; } AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable AstScope* scopep() const { return m_scopep; } // Pointer to scope it's under @@ -1451,7 +1451,7 @@ public: varScopep(varscp); } ASTNODE_NODE_FUNCS(VarRef) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual V3Hash sameHash() const { return V3Hash(V3Hash(varp()->name()),V3Hash(hiername())); } virtual bool same(const AstNode* samep) const { return same(static_cast(samep)); } @@ -1487,7 +1487,7 @@ public: dtypeFrom(varp); } ASTNODE_NODE_FUNCS(VarXRef) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); string dotted() const { return m_dotted; } void dotted(const string& dotted) { m_dotted = dotted; } string prettyDotted() const { return prettyName(dotted()); } @@ -1533,7 +1533,7 @@ public: setNOp1p(exprp); } ASTNODE_NODE_FUNCS(Pin) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual const char* broken() const { BROKEN_RTN(m_modVarp && !m_modVarp->brokeExists()); BROKEN_RTN(m_modPTypep && !m_modPTypep->brokeExists()); @@ -1634,7 +1634,7 @@ public: ASTNODE_NODE_FUNCS(PackageExport) virtual const char* broken() const { BROKEN_RTN(!m_packagep || !m_packagep->brokeExists()); return NULL; } virtual void cloneRelink() { if (m_packagep && m_packagep->clonep()) m_packagep = m_packagep->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } AstPackage* packagep() const { return m_packagep; } void packagep(AstPackage* nodep) { m_packagep=nodep; } @@ -1651,7 +1651,7 @@ public: ASTNODE_NODE_FUNCS(PackageImport) virtual const char* broken() const { BROKEN_RTN(!m_packagep || !m_packagep->brokeExists()); return NULL; } virtual void cloneRelink() { if (m_packagep && m_packagep->clonep()) m_packagep = m_packagep->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } AstPackage* packagep() const { return m_packagep; } void packagep(AstPackage* nodep) { m_packagep=nodep; } @@ -1678,7 +1678,7 @@ public: : AstNode(fl), m_name(name), m_export(isExport), m_ftaskp(NULL) { } ASTNODE_NODE_FUNCS(ModportFTaskRef) virtual const char* broken() const { BROKEN_RTN(m_ftaskp && !m_ftaskp->brokeExists()); return NULL; } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } virtual void cloneRelink() { if (m_ftaskp && m_ftaskp->clonep()) m_ftaskp = m_ftaskp->clonep(); } bool isImport() const { return !m_export; } @@ -1700,7 +1700,7 @@ public: : AstNode(fl), m_name(name), m_type(type), m_varp(NULL) { } ASTNODE_NODE_FUNCS(ModportVarRef) virtual const char* broken() const { BROKEN_RTN(m_varp && !m_varp->brokeExists()); return NULL; } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual void cloneRelink() { if (m_varp && m_varp->clonep()) m_varp = m_varp->clonep(); } virtual string name() const { return m_name; } AstVarType varType() const { return m_type; } // * = Type of variable @@ -1743,7 +1743,7 @@ public: addNOp1p(pinsp); addNOp2p(paramsp); setNOp3p(rangep); } ASTNODE_NODE_FUNCS(Cell) // No cloneRelink, we presume cloneee's want the same module linkages - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual const char* broken() const { BROKEN_RTN(m_modp && !m_modp->brokeExists()); return NULL; } virtual bool maybePointedTo() const { return true; } // ACCESSORS @@ -1780,7 +1780,7 @@ public: : AstNode(fl) , m_name(name), m_origModName(origModName) {} ASTNODE_NODE_FUNCS(CellInline) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); // ACCESSORS virtual string name() const { return m_name; } // * = Cell name string origModName() const { return m_origModName; } // * = modp()->origName() before inlining @@ -1901,7 +1901,7 @@ public: AstParseRef(FileLine* fl, AstParseRefExp expect, const string& name, AstNode* lhsp, AstNodeFTaskRef* ftaskrefp) :AstNode(fl), m_expect(expect), m_name(name) { setNOp1p(lhsp); setNOp2p(ftaskrefp); } ASTNODE_NODE_FUNCS(ParseRef) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } // * = Var name virtual V3Hash sameHash() const { return V3Hash(V3Hash(m_expect),V3Hash(m_name)); } virtual bool same(const AstNode* samep) const { @@ -1934,7 +1934,7 @@ public: virtual bool same(const AstNode* samep) const { return (m_packagep==static_cast(samep)->m_packagep); } virtual V3Hash sameHash() const { return V3Hash(m_packagep); } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); AstPackage* packagep() const { return m_packagep; } void packagep(AstPackage* nodep) { m_packagep=nodep; } }; @@ -1950,7 +1950,7 @@ public: if (!packagep) return rhsp; return new AstDot(fl, new AstPackageRef(fl, packagep), rhsp); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string emitVerilog() { V3ERROR_NA; return ""; } virtual string emitC() { V3ERROR_NA; return ""; } AstNode* lhsp() const { return op1p(); } @@ -2054,7 +2054,7 @@ public: m_edgeType = AstEdgeType::ET_NEVER; } ASTNODE_NODE_FUNCS(SenItem) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual V3Hash sameHash() const { return V3Hash(edgeType()); } virtual bool same(const AstNode* samep) const { return edgeType()==static_cast(samep)->edgeType(); } @@ -2107,7 +2107,7 @@ public: addNOp1p(sensesp); } ASTNODE_NODE_FUNCS(SenTree) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual bool maybePointedTo() const { return true; } bool isMulti() const { return m_multi; } AstNodeSenItem* sensesp() const { return op1p()->castNodeSenItem(); } // op1 = Sensitivity list @@ -2129,7 +2129,7 @@ public: } ASTNODE_NODE_FUNCS(Always) // - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); AstSenTree* sensesp() const { return op1p()->castSenTree(); } // op1 = Sensitivity list AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate void addStmtp(AstNode* nodep) { addOp2p(nodep); } @@ -2334,7 +2334,7 @@ public: if (m_dataDeclp && m_dataDeclp->m_dataDeclp) v3fatalSrc("dataDeclp should point to real data, not be a list"); // Avoid O(n^2) accessing return NULL; } virtual void cloneRelink() { if (m_dataDeclp && m_dataDeclp->clonep()) m_dataDeclp = m_dataDeclp->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual int instrCount() const { return 1+2*instrCountLd(); } virtual bool maybePointedTo() const { return true; } int column() const { return m_column; } @@ -2373,7 +2373,7 @@ public: ASTNODE_NODE_FUNCS(CoverInc) virtual const char* broken() const { BROKEN_RTN(!declp()->brokeExists()); return NULL; } virtual void cloneRelink() { if (m_declp->clonep()) m_declp = m_declp->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual int instrCount() const { return 1+2*instrCountLd(); } virtual V3Hash sameHash() const { return V3Hash(declp()); } virtual bool same(const AstNode* samep) const { @@ -2543,7 +2543,7 @@ public: m_displayType = dispType; } ASTNODE_NODE_FUNCS(Display) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual const char* broken() const { BROKEN_RTN(!fmtp()); return NULL; } virtual string verilogKwd() const { return (filep() ? (string)"$f"+(string)displayType().ascii() : (string)"$"+(string)displayType().ascii()); } @@ -3027,7 +3027,7 @@ public: ASTNODE_NODE_FUNCS(JumpGo) virtual const char* broken() const { BROKEN_RTN(!labelp()->brokeExistsAbove()); return NULL; } virtual void cloneRelink() { if (m_labelp->clonep()) m_labelp = m_labelp->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual int instrCount() const { return instrCountBranch(); } virtual V3Hash sameHash() const { return V3Hash(labelp()); } virtual bool same(const AstNode* samep) const { // Also same if identical tree structure all the way down, but hard to detect @@ -3119,7 +3119,7 @@ public: m_generate = generate; } ASTNODE_NODE_FUNCS(Begin) - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual string name() const { return m_name; } // * = Block name virtual void name(const string& name) { m_name = name; } // op1 = Statements @@ -3191,7 +3191,7 @@ class AstInitArray : public AstNode { // If default is specified, the vector may be sparse, and not provide each value. // Parents: ASTVAR::init() // Children: CONSTs... - deque m_indices; // Which array index each entry in the list is for (if defaultp) + std::deque m_indices; // Which array index each entry in the list is for (if defaultp) public: AstInitArray(FileLine* fl, AstNodeArrayDType* newDTypep, AstNode* defaultp) : AstNode(fl) { @@ -3324,7 +3324,7 @@ public: ASTNODE_NODE_FUNCS(TraceInc) virtual const char* broken() const { BROKEN_RTN(!declp()->brokeExists()); return NULL; } virtual void cloneRelink() { if (m_declp->clonep()) m_declp = m_declp->clonep(); } - virtual void dump(ostream& str); + virtual void dump(std::ostream& str); virtual int instrCount() const { return 10+2*instrCountLd(); } virtual bool hasDType() const { return true; } virtual V3Hash sameHash() const { return V3Hash(declp()); } @@ -3357,7 +3357,7 @@ public: m_sensesp = sensesp; } ASTNODE_NODE_FUNCS(Active) - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual string name() const { return m_name; } virtual const char* broken() const { BROKEN_RTN(m_sensesp && !m_sensesp->brokeExists()); return NULL; } virtual void cloneRelink() { @@ -3395,7 +3395,7 @@ public: AstNode* fromp() const { return op1p(); } AstNode* dimp() const { return op2p(); } AstAttrType attrType() const { return m_attrType; } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); }; class AstScopeName : public AstNodeMath { @@ -3898,7 +3898,7 @@ public: virtual V3Hash sameHash() const { return V3Hash(size()); } virtual bool same(const AstNode* samep) const { return size() == static_cast(samep)->size(); } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); // int size() const { return m_size; } }; @@ -5244,7 +5244,7 @@ public: virtual string name() const { return m_name; } virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode* samep) const { return true; } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); bool slow() const { return m_slow; } void slow(bool flag) { m_slow = flag; } bool source() const { return m_source; } @@ -5305,7 +5305,7 @@ public: virtual string name() const { return m_name; } virtual const char* broken() const { BROKEN_RTN((m_scopep && !m_scopep->brokeExists())); return NULL; } virtual bool maybePointedTo() const { return true; } - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode* samep) const { const AstCFunc* asamep = static_cast(samep); @@ -5394,7 +5394,7 @@ public: if (oldp->argsp()) addNOp1p(oldp->argsp()->unlinkFrBackWithNext()); } ASTNODE_NODE_FUNCS(CCall) - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); virtual void cloneRelink() { if (m_funcp && m_funcp->clonep()) { m_funcp = m_funcp->clonep(); }} @@ -5506,13 +5506,13 @@ public: class AstTypeTable : public AstNode { // Container for hash of standard data types // Children: NODEDTYPEs - typedef map,AstBasicDType*> LogicMap; + typedef std::map,AstBasicDType*> LogicMap; AstBasicDType* m_basicps[AstBasicDTypeKwd::_ENUM_MAX]; // enum { IDX0_LOGIC, IDX0_BIT, _IDX0_MAX }; LogicMap m_logicMap[_IDX0_MAX][AstNumeric::_ENUM_MAX]; // uses above IDX enums // - typedef map DetailedMap; + typedef std::map DetailedMap; DetailedMap m_detailedMap; public: explicit AstTypeTable(FileLine* fl) : AstNode(fl) { @@ -5529,7 +5529,7 @@ public: AstBasicDType* findInsertSameDType(AstBasicDType* nodep); void clearCache(); void repairCache(); - virtual void dump(ostream& str=cout); + virtual void dump(std::ostream& str=std::cout); }; //###################################################################### diff --git a/src/V3Branch.cpp b/src/V3Branch.cpp index 9593d2781..39ea7343b 100644 --- a/src/V3Branch.cpp +++ b/src/V3Branch.cpp @@ -49,7 +49,7 @@ private: AstUser1InUse m_inuser1; // TYPES - typedef vector CFuncVec; + typedef std::vector CFuncVec; // STATE int m_likely; // Excuses for branch likely taken diff --git a/src/V3Broken.cpp b/src/V3Broken.cpp index 5d7abadf6..5b93bd165 100644 --- a/src/V3Broken.cpp +++ b/src/V3Broken.cpp @@ -155,9 +155,9 @@ public: // Use only AstNode::dump instead of the virtual one, as there // may be varp() and other cross links that are bad. if (v3Global.opt.debugCheck()) { - cerr<<"%Error: LeakedNode"<<(it->first->backp()?"Back: ":": "); - ((AstNode*)(it->first))->AstNode::dump(cerr); - cerr<first->backp()?"Back: ":": "); + ((AstNode*)(it->first))->AstNode::dump(std::cerr); + std::cerr<second |= FLAG_LEAKED; diff --git a/src/V3Case.cpp b/src/V3Case.cpp index c57c5dda7..977651be8 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -30,9 +30,9 @@ // Or, converts to a if/else tree. // FUTURES: // Large 16+ bit tables with constants and no masking (address muxes) -// Enter all into multimap, sort by value and use a tree of < and == compares. +// Enter all into std::multimap, sort by value and use a tree of < and == compares. // "Diagonal" find of {rightmost,leftmost} bit {set,clear} -// Ignoring mask, check each value is unique (using multimap as above?) +// Ignoring mask, check each value is unique (using std::multimap as above?) // Each branch is then mask-and-compare operation (IE <000000001_000000000 at midpoint.) // //************************************************************************* @@ -189,7 +189,7 @@ private: if (!m_valueItem[i]) { m_valueItem[i] = itemp; } else if (!itemp->ignoreOverlap() && !bitched) { - itemp->v3warn(CASEOVERLAP,"Case values overlap (example pattern 0x"<v3warn(CASEOVERLAP,"Case values overlap (example pattern 0x"<v3warn(CASEINCOMPLETE,"Case values incompletely covered (example pattern 0x"<v3warn(CASEINCOMPLETE,"Case values incompletely covered (example pattern 0x"<=9) { for (uint32_t i=0; i<(1UL< bool, indicating not hazard - ofstream* m_ofp; // Output file + std::ofstream* m_ofp; // Output file string m_prefix; virtual void visit(AstNode* nodep) { @@ -157,7 +157,7 @@ private: public: // CONSTUCTORS - CdcDumpVisitor(AstNode* nodep, ofstream* ofp, const string& prefix) { + CdcDumpVisitor(AstNode* nodep, std::ofstream* ofp, const string& prefix) { m_ofp = ofp; m_prefix = prefix; nodep->accept(*this); @@ -225,7 +225,7 @@ private: bool m_inDly; // In delayed assign int m_inSenItem; // Number of senitems string m_ofFilename; // Output filename - ofstream* m_ofp; // Output file + std::ofstream* m_ofp; // Output file uint32_t m_userGeneration; // Generation count to avoid slow userClearVertices int m_filelineWidth; // Characters in longest fileline @@ -284,7 +284,7 @@ private: nodep->v3warnCode(code,msg); if (!told_file) { told_file = 1; - cerr<fileline()<<" "< ofp (V3File::new_ofstream(filename)); + const vl_unique_ptr ofp (V3File::new_ofstream(filename)); if (ofp->fail()) v3fatalSrc("Can't write "< report; // Sort output by name + std::deque report; // Sort output by name for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) { if (CdcVarVertex* vvertexp = dynamic_cast(itp)) { AstVar* varp = vvertexp->varScp()->varp(); @@ -508,26 +508,26 @@ private: const char* whatp = "wire"; if (varp->isPrimaryIO()) whatp = (varp->isInout()?"inout":varp->isInput()?"input":"output"); - ostringstream os; - os.setf(ios::left); + std::ostringstream os; + os.setf(std::ios::left); // Module name - doesn't work due to flattening having lost the original // so we assume the modulename matches the filebasename string fname = vvertexp->varScp()->fileline()->filebasename() + ":"; - os<<" "<varScp()->prettyName(); + os<<" "<varScp()->prettyName(); os<<" SRC="; if (vvertexp->srcDomainp()) V3EmitV::verilogForTree(vvertexp->srcDomainp(), os); os<<" DST="; if (vvertexp->dstDomainp()) V3EmitV::verilogForTree(vvertexp->dstDomainp(), os); - os<::iterator it = report.begin(); it!=report.end(); ++it) { + for (std::deque::iterator it = report.begin(); it!=report.end(); ++it) { *ofp << *it; } } @@ -541,7 +541,7 @@ private: // Variables from flops already are domained if (traceDests ? vertexp->dstDomainSet() : vertexp->srcDomainSet()) return; // Fully computed - typedef set SenSet; + typedef std::set SenSet; SenSet senouts; // List of all sensitivities for new signal if (CdcLogicVertex* vvertexp = dynamic_cast(vertexp)) { if (vvertexp) {} // Unused diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 780f93e55..ef3715f3c 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -86,7 +86,7 @@ class CombCallVisitor : CombBaseVisitor { private: // NODE STATE bool m_find; // Find mode vs. delete mode - typedef multimap CallMmap; + typedef std::multimap CallMmap; CallMmap m_callMmap; // Associative array of {function}{call} // METHODS public: @@ -95,7 +95,7 @@ public: if (newfuncp) { UINFO(4, " Replace "< "< eqrange = m_callMmap.equal_range(oldfuncp); + std::pair eqrange = m_callMmap.equal_range(oldfuncp); for (CallMmap::iterator nextit = eqrange.first; nextit != eqrange.second;) { CallMmap::iterator eqit = nextit++; AstCCall* callp = eqit->second; @@ -121,7 +121,7 @@ public: m_callMmap.insert(make_pair(nodep->funcp(), nodep)); } void deleteCall(AstCCall* nodep) { - pair eqrange = m_callMmap.equal_range(nodep->funcp()); + std::pair eqrange = m_callMmap.equal_range(nodep->funcp()); for (CallMmap::iterator nextit = eqrange.first; nextit != eqrange.second;) { CallMmap::iterator eqit = nextit++; AstCCall* callp = eqit->second; @@ -225,7 +225,7 @@ private: if (oldfuncp && oldfuncp->emptyBody() && !oldfuncp->dontCombine()) { - UINFO(5," EmptyFunc "<user4p())<<" "<user4p())<<" "<user4p())<<" "<user4p())<<" "<user4p())<<" "<user4p())<<" "< eqrange = m_hashed.mmap().equal_range(hashval); + std::pair eqrange = m_hashed.mmap().equal_range(hashval); for (V3Hashed::iterator eqit = eqrange.first; eqit != eqrange.second; ++eqit) { AstNode* node2p = eqit->second; if (node1p==node2p) continue; diff --git a/src/V3Config.cpp b/src/V3Config.cpp index 609cc92ef..09b0368b1 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -47,11 +47,11 @@ public: return (m_on>rh.m_on); } }; -ostream& operator<<(ostream& os, V3ConfigLine rhs) { return os< IgnLines; // list of {line,code,on} - typedef map IgnFiles; // {filename} => list of {line,code,on} + typedef std::multiset IgnLines; // list of {line,code,on} + typedef std::map IgnFiles; // {filename} => list of {line,code,on} // MEMBERS string m_lastFilename; // Last filename looked up diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 56293a1f2..b70b979aa 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1757,15 +1757,15 @@ private: if (nextp && !cmp(senp, nextp)) { // Something's out of order, sort it senp = NULL; - vector vec; + std::vector vec; for (AstNodeSenItem* senp = nodep->sensesp()->castNodeSenItem(); senp; senp=senp->nextp()->castNodeSenItem()) { vec.push_back(senp); } stable_sort(vec.begin(), vec.end(), SenItemCmp()); - for (vector::iterator it=vec.begin(); it!=vec.end(); ++it) { + for (std::vector::iterator it=vec.begin(); it!=vec.end(); ++it) { (*it)->unlinkFrBack(); } - for (vector::iterator it=vec.begin(); it!=vec.end(); ++it) { + for (std::vector::iterator it=vec.begin(); it!=vec.end(); ++it) { nodep->addSensesp(*it); } break; diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index 130ae1f26..3ee6bf5af 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -45,7 +45,7 @@ class CoverageVisitor : public AstNVisitor { private: // TYPES - typedef map FileMap; + typedef std::map FileMap; struct ToggleEnt { string m_comment; // Comment for coverage dump diff --git a/src/V3CoverageJoin.cpp b/src/V3CoverageJoin.cpp index 620d44d5c..44ea3270f 100644 --- a/src/V3CoverageJoin.cpp +++ b/src/V3CoverageJoin.cpp @@ -46,7 +46,7 @@ private: //AstUser4InUse In V3Hashed // TYPES - typedef vector ToggleList; + typedef std::vector ToggleList; // STATE ToggleList m_toggleps; // List of of all AstCoverToggle's diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index a5a75bb9f..19e024fb8 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -89,15 +89,15 @@ private: AstUser1InUse m_inuser1; // TYPES - typedef multimap AssignMap; + typedef std::multimap AssignMap; // STATE AstNodeModule* m_modp; // Current module - vector m_varsp; // List of all encountered to avoid another loop through tree - vector m_dtypesp; // List of all encountered to avoid another loop through tree - vector m_vscsp; // List of all encountered to avoid another loop through tree - vector m_scopesp; // List of all encountered to avoid another loop through tree - vector m_cellsp; // List of all encountered to avoid another loop through tree + std::vector m_varsp; // List of all encountered to avoid another loop through tree + std::vector m_dtypesp; // List of all encountered to avoid another loop through tree + std::vector m_vscsp; // List of all encountered to avoid another loop through tree + std::vector m_scopesp; // List of all encountered to avoid another loop through tree + std::vector m_cellsp; // List of all encountered to avoid another loop through tree AssignMap m_assignMap; // List of all simple assignments for each variable bool m_elimUserVars; // Allow removal of user's vars bool m_elimDTypes; // Allow removal of DTypes @@ -307,7 +307,7 @@ private: void deadCheckScope() { for (bool retry=true; retry; ) { retry = false; - for (vector::iterator it = m_scopesp.begin(); it != m_scopesp.end();++it) { + for (std::vector::iterator it = m_scopesp.begin(); it != m_scopesp.end();++it) { AstScope* scp = *it; if (!scp) continue; @@ -326,7 +326,7 @@ private: } void deadCheckCells() { - for (vector::iterator it = m_cellsp.begin(); it!=m_cellsp.end(); ++it) { + for (std::vector::iterator it = m_cellsp.begin(); it!=m_cellsp.end(); ++it) { AstCell* cellp = *it; if (cellp->user1() == 0 && !cellp->modp()->stmtsp()) { cellp->modp()->user1Inc(-1); @@ -337,11 +337,11 @@ private: void deadCheckVar() { // Delete any unused varscopes - for (vector::iterator it = m_vscsp.begin(); it!=m_vscsp.end(); ++it) { + for (std::vector::iterator it = m_vscsp.begin(); it!=m_vscsp.end(); ++it) { AstVarScope* vscp = *it; if (vscp->user1() == 0) { UINFO(4," Dead "< eqrange = m_assignMap.equal_range(vscp); + std::pair eqrange = m_assignMap.equal_range(vscp); for (AssignMap::iterator itr = eqrange.first; itr != eqrange.second; ++itr) { AstNodeAssign* assp = itr->second; UINFO(4," Dead assign "<::iterator it = m_varsp.begin(); it != m_varsp.end();++it) { + for (std::vector::iterator it = m_varsp.begin(); it != m_varsp.end();++it) { AstVar* varp = *it; if (!varp) continue; @@ -370,7 +370,7 @@ private: } } } - for (vector::iterator it = m_dtypesp.begin(); it != m_dtypesp.end();++it) { + for (std::vector::iterator it = m_dtypesp.begin(); it != m_dtypesp.end();++it) { if ((*it)->user1() == 0) { AstNodeClassDType *classp; // It's possible that there if a reference to each individual member, but diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 20d2f7d02..6c3982a1c 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -98,7 +98,7 @@ private: bool m_inDly; // True in delayed assignments bool m_inLoop; // True in for loops bool m_inInitial; // True in intial blocks - typedef std::map,AstVar*> VarMap; + typedef std::map,AstVar*> VarMap; VarMap m_modVarMap; // Table of new var names created under module V3Double0 m_statSharedSet;// Statistic tracking typedef std::map ScopeVecMap; @@ -200,7 +200,7 @@ private: UINFO(4,"AssignDlyArray: "< dimvalp; // Assignment value for each dimension of assignment + std::deque dimvalp; // Assignment value for each dimension of assignment AstNode* dimselp=arrayselp; for (; dimselp->castArraySel(); dimselp=dimselp->castArraySel()->fromp()) { AstNode* valp = dimselp->castArraySel()->bitp()->unlinkFrBack(); @@ -213,7 +213,7 @@ private: AstVar* oldvarp = varrefp->varp(); int modVecNum = m_scopeVecMap[varrefp->varScopep()]++; // - deque dimreadps; // Read value for each dimension of assignment + std::deque dimreadps; // Read value for each dimension of assignment for (unsigned dimension=0; dimensioncastConst()) { // bit = const, can just use it diff --git a/src/V3Descope.cpp b/src/V3Descope.cpp index e227feffc..2eb8bed62 100644 --- a/src/V3Descope.cpp +++ b/src/V3Descope.cpp @@ -48,7 +48,7 @@ private: AstUser1InUse m_inuser1; // TYPES - typedef multimap FuncMmap; + typedef std::multimap FuncMmap; // STATE AstNodeModule* m_modp; // Current module diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 735e14713..2b98e1d8f 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -46,7 +46,7 @@ class EmitCStmts : public EmitCBaseVisitor { private: bool m_suppressSemi; AstVarRef* m_wideTempRefp; // Variable that _WW macros should be setting - vector m_ctorVarsVec; // All variables in constructor order + std::vector m_ctorVarsVec; // All variables in constructor order int m_splitSize; // # of cfunc nodes placed into output file int m_splitFilenum; // File number being created, 0 = primary @@ -773,7 +773,7 @@ public: class EmitCImp : EmitCStmts { // MEMBERS AstNodeModule* m_modp; - vector m_blkChangeDetVec; // All encountered changes in block + std::vector m_blkChangeDetVec; // All encountered changes in block bool m_slow; // Creating __Slow file bool m_fast; // Creating non __Slow file (or both) @@ -915,7 +915,7 @@ class EmitCImp : EmitCStmts { putsDecoration("// Change detection\n"); puts("QData __req = false; // Logically a bool\n"); // But not because it results in faster code bool gotOne = false; - for (vector::iterator it = m_blkChangeDetVec.begin(); + for (std::vector::iterator it = m_blkChangeDetVec.begin(); it != m_blkChangeDetVec.end(); ++it) { AstChangeDet* changep = *it; if (changep->lhsp()) { @@ -929,7 +929,7 @@ class EmitCImp : EmitCStmts { if (gotOne) { puts(");\n"); //puts("VL_DEBUG_IF( if (__req) cout<<\"\tCLOCKREQ );"); - for (vector::iterator it = m_blkChangeDetVec.begin(); + for (std::vector::iterator it = m_blkChangeDetVec.begin(); it != m_blkChangeDetVec.end(); ++it) { AstChangeDet* nodep = *it; if (nodep->lhsp()) { @@ -1077,7 +1077,7 @@ void EmitCStmts::emitVarCtors() { puts("\n"); puts("#if (SYSTEMC_VERSION>20011000)\n"); // SystemC 2.0.1 and newer bool first = true; - for (vector::iterator it = m_ctorVarsVec.begin(); it != m_ctorVarsVec.end(); ++it) { + for (std::vector::iterator it = m_ctorVarsVec.begin(); it != m_ctorVarsVec.end(); ++it) { AstVar* varp = *it; bool isArray = !varp->dtypeSkipRefp()->castBasicDType(); if (isArray) { @@ -1210,9 +1210,9 @@ void EmitCStmts::emitOpName(AstNode* nodep, const string& format, struct EmitDispState { string m_format; // "%s" and text from user - vector m_argsChar; // Format of each argument to be printed - vector m_argsp; // Each argument to be printed - vector m_argsFunc; // Function before each argument to be printed + std::vector m_argsChar; // Format of each argument to be printed + std::vector m_argsp; // Each argument to be printed + std::vector m_argsFunc; // Function before each argument to be printed EmitDispState() { clear(); } void clear() { m_format = ""; @@ -1903,7 +1903,7 @@ struct CmpName { }; void EmitCImp::emitIntFuncDecls(AstNodeModule* modp) { - vector funcsp; + std::vector funcsp; for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) { if (AstCFunc* funcp = nodep->castCFunc()) { @@ -1915,7 +1915,7 @@ void EmitCImp::emitIntFuncDecls(AstNodeModule* modp) { stable_sort(funcsp.begin(), funcsp.end(), CmpName()); - for (vector::iterator it = funcsp.begin(); it != funcsp.end(); ++it) { + for (std::vector::iterator it = funcsp.begin(); it != funcsp.end(); ++it) { AstCFunc* funcp = *it; if (!funcp->dpiImport()) { // DPI is prototyped in __Dpi.h ofp()->putsPrivate(funcp->declPrivate()); diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 974db74ef..7a6b4b4ce 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -57,11 +57,11 @@ class EmitCSyms : EmitCBaseVisitor { ScopeVarData(const string& scopeName, const string& varBasePretty, AstVar* varp, AstNodeModule* modp, AstScope* scopep) : m_scopeName(scopeName), m_varBasePretty(varBasePretty), m_varp(varp), m_modp(modp), m_scopep(scopep) {} }; - typedef map ScopeFuncs; - typedef map ScopeVars; - typedef map ScopeNames; - typedef pair ScopeModPair; - typedef pair ModVarPair; + typedef std::map ScopeFuncs; + typedef std::map ScopeVars; + typedef std::map ScopeNames; + typedef std::pair ScopeModPair; + typedef std::pair ModVarPair; struct CmpName { inline bool operator () (const ScopeModPair& lhsp, const ScopeModPair& rhsp) const { return lhsp.first->name() < rhsp.first->name(); @@ -80,9 +80,9 @@ class EmitCSyms : EmitCBaseVisitor { // STATE AstCFunc* m_funcp; // Current function AstNodeModule* m_modp; // Current module - vector m_scopes; // Every scope by module - vector m_dpis; // DPI functions - vector m_modVars; // Each public {mod,var} + std::vector m_scopes; // Every scope by module + std::vector m_dpis; // DPI functions + std::vector m_modVars; // Each public {mod,var} ScopeNames m_scopeNames; // Each unique AstScopeName ScopeFuncs m_scopeFuncs; // Each {scope,dpi-export-func} ScopeVars m_scopeVars; // Each {scope,public-var} @@ -112,9 +112,9 @@ class EmitCSyms : EmitCBaseVisitor { // We didn'e have all m_scopes loaded when we encountered variables, so expand them now // It would be less code if each module inserted its own variables. // Someday. For now public isn't common. - for (vector::iterator itsc = m_scopes.begin(); itsc != m_scopes.end(); ++itsc) { + for (std::vector::iterator itsc = m_scopes.begin(); itsc != m_scopes.end(); ++itsc) { AstScope* scopep = itsc->first; AstNodeModule* smodp = itsc->second; - for (vector::iterator it = m_modVars.begin(); it != m_modVars.end(); ++it) { + for (std::vector::iterator it = m_modVars.begin(); it != m_modVars.end(); ++it) { AstNodeModule* modp = it->first; AstVar* varp = it->second; if (modp == smodp) { @@ -284,7 +284,7 @@ void EmitCSyms::emitSymHdr() { if (v3Global.dpi()) { puts ("\n// DPI TYPES for DPI Export callbacks (Internal use)\n"); - map types; // Remove duplicates and sort + std::map types; // Remove duplicates and sort for (ScopeFuncs::iterator it = m_scopeFuncs.begin(); it != m_scopeFuncs.end(); ++it) { AstCFunc* funcp = it->second.m_funcp; if (funcp->dpiExport()) { @@ -292,7 +292,7 @@ void EmitCSyms::emitSymHdr() { types["typedef void (*"+cbtype+") ("+cFuncArgs(funcp)+");\n"] = 1; } } - for (map::iterator it = types.begin(); it != types.end(); ++it) { + for (std::map::iterator it = types.begin(); it != types.end(); ++it) { puts(it->first); } } @@ -309,7 +309,7 @@ void EmitCSyms::emitSymHdr() { puts("bool __Vm_didInit;\n"); puts("\n// SUBCELL STATE\n"); - for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { + for (std::vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstNodeModule* modp = it->second; if (modp->isTop()) { ofp()->printf("%-30s ", (modClassName(modp)+"*").c_str()); @@ -385,7 +385,7 @@ void EmitCSyms::emitSymImp() { puts("\t, __Vm_didInit(false)\n"); puts("\t// Setup submodule names\n"); char comma=','; - for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { + for (std::vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstNodeModule* modp = it->second; if (modp->isTop()) { } else { @@ -403,7 +403,7 @@ void EmitCSyms::emitSymImp() { puts("// Pointer to top level\n"); puts("TOPp = topp;\n"); puts("// Setup each module's pointers to their submodules\n"); - for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { + for (std::vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstNodeModule* modp = it->second; if (!modp->isTop()) { string arrow = scopep->name(); @@ -420,7 +420,7 @@ void EmitCSyms::emitSymImp() { puts("// Setup each module's pointer back to symbol table (for public functions)\n"); puts("TOPp->__Vconfigure(this, true);\n"); - for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { + for (std::vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstNodeModule* modp = it->second; if (!modp->isTop()) { // first is used by AstCoverDecl's call to __vlCoverInsert @@ -533,7 +533,7 @@ void EmitCSyms::emitSymImp() { } puts( "os"+op+"__Vm_didInit;\n"); puts( "// SUBCELL STATE\n"); - for (vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { + for (std::vector::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) { AstScope* scopep = it->first; AstNodeModule* modp = it->second; if (!modp->isTop()) { puts( scopep->nameDotless()+"."+funcname+"(os);\n"); @@ -570,7 +570,7 @@ void EmitCSyms::emitDpiHdr() { int firstExp = 0; int firstImp = 0; - for (vector::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) { + for (std::vector::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) { AstCFunc* nodep = *it; if (nodep->dpiExportWrapper()) { if (!firstExp++) puts("\n// DPI EXPORTS\n"); @@ -618,7 +618,7 @@ void EmitCSyms::emitDpiImp() { puts("#include \""+topClassName()+".h\"\n"); puts("\n"); - for (vector::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) { + for (std::vector::iterator it = m_dpis.begin(); it != m_dpis.end(); ++it) { AstCFunc* nodep = *it; if (nodep->dpiExportWrapper()) { puts("#ifndef _VL_DPIDECL_"+nodep->name()+"\n"); diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index 11f4e4650..7026f805d 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -626,7 +626,7 @@ public: class EmitVStreamVisitor : public EmitVBaseVisitor { // MEMBERS - ostream& m_os; + std::ostream& m_os; // METHODS virtual void putsNoTracking(const string& str) { m_os<accept(*this); } @@ -645,7 +645,7 @@ public: // Emit to a stream (perhaps stringstream) class EmitVPrefixedFormatter : public V3OutFormatter { - ostream& m_os; + std::ostream& m_os; string m_prefix; // What to print at beginning of each line int m_flWidth; // Padding of fileline int m_column; // Rough location; need just zero or non-zero @@ -671,7 +671,7 @@ public: void prefixFl(FileLine* fl) { m_prefixFl = fl; } FileLine* prefixFl() const { return m_prefixFl; } int column() const { return m_column; } - EmitVPrefixedFormatter(ostream& os, const string& prefix, int flWidth) + EmitVPrefixedFormatter(std::ostream& os, const string& prefix, int flWidth) : V3OutFormatter("__STREAM", V3OutFormatter::LA_VERILOG) , m_os(os), m_prefix(prefix), m_flWidth(flWidth) { m_column = 0; @@ -703,7 +703,7 @@ class EmitVPrefixedVisitor : public EmitVBaseVisitor { } public: - EmitVPrefixedVisitor(AstNode* nodep, ostream& os, const string& prefix, int flWidth, + EmitVPrefixedVisitor(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth, AstSenTree* domainp, bool user3mark) : EmitVBaseVisitor(domainp), m_formatter(os, prefix, flWidth) { if (user3mark) { AstUser3InUse::check(); } @@ -734,11 +734,11 @@ void V3EmitV::emitv() { } } -void V3EmitV::verilogForTree(AstNode* nodep, ostream& os) { +void V3EmitV::verilogForTree(AstNode* nodep, std::ostream& os) { EmitVStreamVisitor(nodep, os); } -void V3EmitV::verilogPrefixedTree(AstNode* nodep, ostream& os, const string& prefix, int flWidth, +void V3EmitV::verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth, AstSenTree* domainp, bool user3mark) { EmitVPrefixedVisitor(nodep, os, prefix, flWidth, domainp, user3mark); } diff --git a/src/V3EmitV.h b/src/V3EmitV.h index cf1fd97aa..bf8c2daa8 100644 --- a/src/V3EmitV.h +++ b/src/V3EmitV.h @@ -30,8 +30,8 @@ class V3EmitV { public: static void emitv(); - static void verilogForTree(AstNode* nodep, ostream& os=cout); - static void verilogPrefixedTree(AstNode* nodep, ostream& os, const string& prefix, int flWidth, + static void verilogForTree(AstNode* nodep, std::ostream& os=std::cout); + static void verilogPrefixedTree(AstNode* nodep, std::ostream& os, const string& prefix, int flWidth, AstSenTree* domainp, bool user3percent); }; diff --git a/src/V3Error.cpp b/src/V3Error.cpp index b12f5b84f..b1da4d33b 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -38,7 +38,7 @@ int V3Error::s_debugDefault = 0; int V3Error::s_errorLimit = V3Error::MAX_ERRORS; bool V3Error::s_warnFatal = true; int V3Error::s_tellManual = 0; -ostringstream V3Error::s_errorStr; // Error string being formed +std::ostringstream V3Error::s_errorStr; // Error string being formed V3ErrorCode V3Error::s_errorCode = V3ErrorCode::EC_FATAL; bool V3Error::s_errorSuppressed = false; bool V3Error::s_describedEachWarn[V3ErrorCode::_ENUM_MAX]; @@ -81,10 +81,10 @@ void V3Error::init() { } string V3Error::lineStr (const char* filename, int lineno) { - ostringstream out; + std::ostringstream out; const char* fnslashp = strrchr (filename, '/'); if (fnslashp) filename = fnslashp+1; - out<20) numsp = 20; out<<(spaces + numsp); @@ -101,11 +101,11 @@ void V3Error::incErrors() { void V3Error::abortIfWarnings() { bool exwarn = warnFatal() && warnCount(); if (errorCount() && exwarn) { - v3fatal ("Exiting due to "<=V3ErrorCode::EC_FIRST_WARN && !s_describedWarnings) { - cerr< MessagesSet; + typedef std::set MessagesSet; typedef void (*ErrorExitCb)(void); private: @@ -209,7 +209,7 @@ class V3Error { static int s_errCount; // Error count static int s_warnCount; // Warning count static int s_tellManual; // Tell user to see manual, 0=not yet, 1=doit, 2=disable - static ostringstream s_errorStr; // Error string being formed + static std::ostringstream s_errorStr; // Error string being formed static V3ErrorCode s_errorCode; // Error string being formed will abort static bool s_errorSuppressed; // Error being formed should be suppressed static MessagesSet s_messages; // What errors we've outputted @@ -217,7 +217,7 @@ class V3Error { enum MaxErrors { MAX_ERRORS = 50 }; // Fatal after this may errors - V3Error() { cerr<<("Static class"); abort(); } + V3Error() { std::cerr<<("Static class"); abort(); } public: // CONSTRUCTORS @@ -252,15 +252,15 @@ class V3Error { // Error end takes the string stream to output, be careful to seek() as needed static void v3errorPrep(V3ErrorCode code) { s_errorStr.str(""); s_errorCode=code; s_errorSuppressed=false; } - static ostringstream& v3errorStr() { return s_errorStr; } + static std::ostringstream& v3errorStr() { return s_errorStr; } static void vlAbort(); - static void v3errorEnd(ostringstream& sstr); // static, but often overridden in classes. + static void v3errorEnd(std::ostringstream& sstr); // static, but often overridden in classes. }; // Global versions, so that if the class doesn't define a operator, we get the functions anyways. inline int debug() { return V3Error::debugDefault(); } -inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); } -inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); VL_UNREACHABLE } +inline void v3errorEnd(std::ostringstream& sstr) { V3Error::v3errorEnd(sstr); } +inline void v3errorEndFatal(std::ostringstream& sstr) { V3Error::v3errorEnd(sstr); assert(0); VL_UNREACHABLE } // Theses allow errors using << operators: v3error("foo"<<"bar"); // Careful, you can't put () around msg, as you would in most macro definitions @@ -273,7 +273,7 @@ inline void v3errorEndFatal(ostringstream& sstr) { V3Error::v3errorEnd(sstr); as #define v3error(msg) v3warnCode(V3ErrorCode::EC_ERROR, msg) #define v3fatal(msg) v3warnCodeFatal(V3ErrorCode::EC_FATAL, msg) // Use this instead of fatal() to mention the source code line. -#define v3fatalSrc(msg) v3warnCodeFatal(V3ErrorCode::EC_FATALSRC, __FILE__<<":"<=(level))) { cout<<"- "<=(level))) { cout< std::string cvtToStr (const T& t) { - ostringstream os; os< m_filenameSet; // Files generated (elim duplicates) - set m_filenameList; // Files sourced/generated + std::set m_filenameSet; // Files generated (elim duplicates) + std::set m_filenameList; // Files sourced/generated static string stripQuotes(const string& in) { string pretty = in; @@ -134,10 +134,10 @@ V3FileDependImp dependImp; // Depend implementation class // V3FileDependImp inline void V3FileDependImp::writeDepend(const string& filename) { - const vl_unique_ptr ofp (V3File::new_ofstream(filename)); + const vl_unique_ptr ofp (V3File::new_ofstream(filename)); if (ofp->fail()) v3fatalSrc("Can't write "<::iterator iter=m_filenameList.begin(); + for (std::set::iterator iter=m_filenameList.begin(); iter!=m_filenameList.end(); ++iter) { if (iter->target()) { *ofp<filename()<<" "; @@ -149,7 +149,7 @@ inline void V3FileDependImp::writeDepend(const string& filename) { *ofp<::iterator iter=m_filenameList.begin(); + for (std::set::iterator iter=m_filenameList.begin(); iter!=m_filenameList.end(); ++iter) { if (!iter->target()) { *ofp<filename()<<" "; @@ -160,7 +160,7 @@ inline void V3FileDependImp::writeDepend(const string& filename) { if (v3Global.opt.makePhony()) { *ofp<::iterator iter=m_filenameList.begin(); + for (std::set::iterator iter=m_filenameList.begin(); iter!=m_filenameList.end(); ++iter) { if (!iter->target()) { *ofp<filename()<<":"< ofp (V3File::new_ofstream(filename)); + const vl_unique_ptr ofp (V3File::new_ofstream(filename)); if (ofp->fail()) v3fatalSrc("Can't write "<::iterator iter=m_filenameList.begin(); + for (std::set::iterator iter=m_filenameList.begin(); iter!=m_filenameList.end(); ++iter) { // Read stats of files we create after we're done making them (execpt for this file, of course) DependFile* dfp = (DependFile*)&(*iter); @@ -188,19 +188,19 @@ inline void V3FileDependImp::writeTimes(const string& filename, const string& cm if (dfp->filename() == filename) { showSize=0; showIno=0; } // We're writing it, so need to ignore it *ofp<<(iter->target()?"T":"S")<<" "; - *ofp<<" "<cstime(); - *ofp<<" "<cnstime(); - *ofp<<" "<mstime(); - *ofp<<" "<mnstime(); + *ofp<<" "<cstime(); + *ofp<<" "<cnstime(); + *ofp<<" "<mstime(); + *ofp<<" "<mnstime(); *ofp<<" \""<filename()<<"\""; *ofp< ifp (V3File::new_ifstream_nodepend(filename)); + const vl_unique_ptr ifp (V3File::new_ifstream_nodepend(filename)); if (ifp->fail()) { UINFO(2," --check-times failed: no input "< FileContentsMap; + typedef std::map FileContentsMap; typedef V3InFilter::StrList StrList; FileContentsMap m_contentsMap; // Cache of file contents diff --git a/src/V3File.h b/src/V3File.h index 02fefebaf..caec2ca85 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -34,23 +34,23 @@ class V3File { public: - static ifstream* new_ifstream(const string& filename) { + static std::ifstream* new_ifstream(const string& filename) { addSrcDepend(filename); return new_ifstream_nodepend (filename); } - static ifstream* new_ifstream_nodepend(const string& filename) { - return new ifstream(filename.c_str()); + static std::ifstream* new_ifstream_nodepend(const string& filename) { + return new std::ifstream(filename.c_str()); } - static ofstream* new_ofstream(const string& filename, bool append=false) { + static std::ofstream* new_ofstream(const string& filename, bool append=false) { addTgtDepend(filename); return new_ofstream_nodepend (filename, append); } - static ofstream* new_ofstream_nodepend(const string& filename, bool append=false) { + static std::ofstream* new_ofstream_nodepend(const string& filename, bool append=false) { if (filename != VL_DEV_NULL) createMakeDir(); if (append) { - return new ofstream(filename.c_str(), ios::app); + return new std::ofstream(filename.c_str(), std::ios::app); } else { - return new ofstream(filename.c_str()); + return new std::ofstream(filename.c_str()); } } static FILE* new_fopen_w(const string& filename) { @@ -78,7 +78,7 @@ class V3InFilterImp; class V3InFilter { public: // TYPES - typedef list StrList; + typedef std::list StrList; private: V3InFilterImp* m_impp; @@ -123,7 +123,7 @@ private: int m_nobreak; // Basic operator or begin paren, don't break next bool m_prependIndent; int m_indentLevel; // Current {} indentation - stack m_parenVec; // Stack of columns where last ( was + std::stack m_parenVec; // Stack of columns where last ( was int endLevels(const char* strg); const char* indentStr(int levels); diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index bef554728..5f608459b 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -71,7 +71,7 @@ int FileLineSingleton::nameToNumber(const string& filename) { //! Support XML output //! Experimental. Updated to also put out the language. -void FileLineSingleton::fileNameNumMapDumpXml(ostream& os) { +void FileLineSingleton::fileNameNumMapDumpXml(std::ostream& os) { os<<"\n"; for (FileNameNumMap::const_iterator it = m_namemap.begin(); it != m_namemap.end(); ++it) { os<<"second) @@ -184,8 +184,8 @@ const string FileLine::profileFuncname() const { string FileLine::ascii() const { return filename()+":"+cvtToStr(lineno()); } -ostream& operator<<(ostream& os, FileLine* fileline) { - os <ascii()<<": "<ascii()<<": "< FileNameNumMap; - typedef map FileLangNumMap; + typedef std::map FileNameNumMap; + typedef std::map FileLangNumMap; // MEMBERS FileNameNumMap m_namemap; // filenameno for each filename - deque m_names; // filename text for each filenameno - deque m_languages; // language for each filenameno + std::deque m_names; // filename text for each filenameno + std::deque m_languages; // language for each filenameno // COSNTRUCTORS FileLineSingleton() { } ~FileLineSingleton() { } @@ -60,7 +60,7 @@ protected: const V3LangCode numberToLang(int filenameno) const { return m_languages[filenameno]; } void numberToLang(int filenameno, const V3LangCode& l) { m_languages[filenameno] = l; } void clear() { m_namemap.clear(); m_names.clear(); m_languages.clear(); } - void fileNameNumMapDumpXml(ostream& os); + void fileNameNumMapDumpXml(std::ostream& os); static const string filenameLetters(int fileno); }; @@ -72,7 +72,7 @@ protected: class FileLine { int m_lineno; int m_filenameno; - bitset m_warnOn; + std::bitset m_warnOn; private: struct EmptySecret {}; @@ -148,7 +148,7 @@ public: defaultFileLine().warnOff(code, flag); } static bool globalWarnOff(const string& code, bool flag) { return defaultFileLine().warnOff(code, flag); } - static void fileNameNumMapDumpXml(ostream& os) { + static void fileNameNumMapDumpXml(std::ostream& os) { singleton().fileNameNumMapDumpXml(os); } // METHODS - Called from netlist @@ -160,17 +160,17 @@ public: void modifyWarnOff(V3ErrorCode code, bool flag) { warnOff(code,flag); } // OPERATORS - void v3errorEnd(ostringstream& str); - void v3errorEndFatal(ostringstream& str); + void v3errorEnd(std::ostringstream& str); + void v3errorEndFatal(std::ostringstream& str); string warnMore() const; inline bool operator==(FileLine rhs) const { return (m_lineno==rhs.m_lineno && m_filenameno==rhs.m_filenameno && m_warnOn==rhs.m_warnOn); } private: - void v3errorEndFatalGuts(ostringstream& str); + void v3errorEndFatalGuts(std::ostringstream& str); }; -ostream& operator<<(ostream& os, FileLine* fileline); +std::ostream& operator<<(std::ostream& os, FileLine* fileline); -inline void FileLine::v3errorEndFatal(ostringstream& str) { v3errorEnd(str); assert(0); } +inline void FileLine::v3errorEndFatal(std::ostringstream& str) { v3errorEnd(str); assert(0); } #endif // Guard diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 944bf34ee..25b57ee0e 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -45,7 +45,7 @@ #include "V3Stats.h" #include "V3Hashed.h" -typedef list GateVarRefList; +typedef std::list GateVarRefList; #define GATE_DEDUP_MAX_DEPTH 20 @@ -728,7 +728,7 @@ void GateVisitor::replaceAssigns() { //if (debug()>9) {vscp->dumpTree(cout, "-vscDone: "); cout<valuep()->castNodeMath() || vscp->valuep()->nextp()) { - vscp->dumpTree(cerr, "vscStrange: "); + vscp->dumpTree(std::cerr, "vscStrange: "); vscp->v3fatalSrc("Value of varscope not mathematical"); } } diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index 16ce46cbe..7ff1916f8 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -33,7 +33,7 @@ #include "V3Graph.h" int V3Graph::s_debug = 0; -int V3Graph::debug() { return max(V3Error::debugDefault(), s_debug); } +int V3Graph::debug() { return std::max(V3Error::debugDefault(), s_debug); } //###################################################################### //###################################################################### @@ -82,7 +82,7 @@ void V3GraphVertex::rerouteEdges(V3Graph* graphp) { for (V3GraphEdge* iedgep = inBeginp(); iedgep; iedgep=iedgep->inNextp()) { for (V3GraphEdge* oedgep = outBeginp(); oedgep; oedgep=oedgep->outNextp()) { new V3GraphEdge (graphp, iedgep->fromp(), oedgep->top(), - min(iedgep->weight(),oedgep->weight()), + std::min(iedgep->weight(),oedgep->weight()), iedgep->cutable() && oedgep->cutable()); } } @@ -118,7 +118,7 @@ uint32_t V3GraphVertex::outHash() const { return hash; } -ostream& operator<<(ostream& os, V3GraphVertex* vertexp) { +std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp) { os<<" VERTEX="<name(); if (vertexp->rank()) os<<" r"<rank(); if (vertexp->fanout()!=0.0) os<<" f"<fanout(); @@ -241,10 +241,10 @@ void V3Graph::clearColors() { void V3Graph::loopsVertexCb(V3GraphVertex* vertexp) { // Needed here as V3GraphVertex<< isn't defined until later in header - cerr<<"-Info-Loop: "<<(void*)(vertexp)<<" "<weight() && (edgep->fromp() == vertexp || edgep->top() == vertexp)) { @@ -288,7 +288,7 @@ void V3Graph::dumpDotFilePrefixedAlways(const string& nameComment, bool colorAsS void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const { // This generates a file used by graphviz, http://www.graphviz.org // "hardcoded" parameters: - const vl_unique_ptr logp (V3File::new_ofstream(filename)); + const vl_unique_ptr logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "< SubgraphMmap; + typedef std::multimap SubgraphMmap; SubgraphMmap subgraphs; for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { string vertexSubgraph = (colorAsSubgraph && vertexp->color()) ? cvtToStr(vertexp->color()) : ""; @@ -308,7 +308,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const { // We use a map here, as we don't want to corrupt anything (userp) in the graph, // and we don't care if this is slow. - map numMap; + std::map numMap; // Print vertices int n=0; diff --git a/src/V3Graph.h b/src/V3Graph.h index aeafc0cd5..1cfac53e9 100644 --- a/src/V3Graph.h +++ b/src/V3Graph.h @@ -57,7 +57,7 @@ protected: void acyclicCut(); void acyclicLoop(V3GraphVertex* vertexp, int depth); double orderDFSIterate(V3GraphVertex* vertexp); - void dumpEdge(ostream& os, V3GraphVertex* vertexp, V3GraphEdge* edgep); + void dumpEdge(std::ostream& os, V3GraphVertex* vertexp, V3GraphEdge* edgep); void verticesUnlink() { m_vertices.reset(); } // ACCESSORS static int debug(); @@ -126,7 +126,7 @@ public: void subtreeLoops(V3EdgeFuncP edgeFuncp, V3GraphVertex* vertexp, V3Graph* loopGraphp); /// Debugging - void dump(ostream& os=cout); + void dump(std::ostream& os=std::cout); void dumpDotFile(const string& filename, bool colorAsSubgraph) const; void dumpDotFilePrefixed(const string& nameComment, bool colorAsSubgraph=false) const; void dumpDotFilePrefixedAlways(const string& nameComment, bool colorAsSubgraph=false) const; @@ -212,7 +212,7 @@ public: void rerouteEdges(V3Graph* graphp); ///< Edges are routed around this vertex to point from "from" directly to "to" }; -ostream& operator<<(ostream& os, V3GraphVertex* vertexp); +std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp); //============================================================================ diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index c5e51ad14..cc694f06d 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -63,7 +63,7 @@ public: class GraphAcycEdge : public V3GraphEdge { // userp() is always used to point to the head original graph edge private: - typedef list OrigEdgeList; // List of orig edges, see also GraphAcyc's decl + typedef std::list OrigEdgeList; // List of orig edges, see also GraphAcyc's decl V3GraphEdge* origEdgep() const { OrigEdgeList* oEListp = ((OrigEdgeList*)userp()); if (!oEListp) v3fatalSrc("No original edge associated with acyc edge "< OrigEdgeList; // List of orig edges, see also GraphAcycEdge's decl + typedef std::list OrigEdgeList; // List of orig edges, see also GraphAcycEdge's decl // GRAPH USERS // origGraph // GraphVertex::user() GraphAycVerted* New graph node @@ -104,7 +104,7 @@ private: V3Graph* m_origGraphp; // Original graph V3Graph m_breakGraph; // Graph with only breakable edges represented V3List m_work; // List of vertices with optimization work left - vector m_origEdgeDelp; // List of deletions to do when done + std::vector m_origEdgeDelp; // List of deletions to do when done V3EdgeFuncP m_origEdgeFuncp; // Function that says we follow this edge (in original graph) uint32_t m_placeStep; // Number that user() must be equal to to indicate processing @@ -189,7 +189,7 @@ public: m_placeStep = 0; } ~GraphAcyc() { - for (vector::iterator it = m_origEdgeDelp.begin(); it != m_origEdgeDelp.end(); ++it) { + for (std::vector::iterator it = m_origEdgeDelp.begin(); it != m_origEdgeDelp.end(); ++it) { delete (*it); } m_origEdgeDelp.clear(); @@ -453,7 +453,7 @@ void GraphAcyc::place() { } UINFO(4, " Cutable edges = "< edges; // List of all edges to be processed + std::vector edges; // List of all edges to be processed edges.reserve(numEdges+1); // Make the vector properly sized right off the bat -- faster than reallocating for (V3GraphVertex* vertexp = m_breakGraph.verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { vertexp->user(0); // Clear in prep of next step @@ -469,7 +469,7 @@ void GraphAcyc::place() { // Process each edge in weighted order m_placeStep = 10; - for (vector::iterator it = edges.begin(); it!=edges.end(); ++it) { + for (std::vector::iterator it = edges.begin(); it!=edges.end(); ++it) { V3GraphEdge* edgep = (*it); placeTryEdge(edgep); } diff --git a/src/V3GraphAlg.cpp b/src/V3GraphAlg.cpp index 64d6e8011..6c8f1f1e3 100644 --- a/src/V3GraphAlg.cpp +++ b/src/V3GraphAlg.cpp @@ -186,7 +186,7 @@ void V3Graph::weaklyConnected(V3EdgeFuncP edgeFuncp) { class GraphAlgStrongly : GraphAlg { private: uint32_t m_currentDfs; // DFS count - vector m_callTrace; // List of everything we hit processing so far + std::vector m_callTrace; // List of everything we hit processing so far void main() { // Use Tarjan's algorithm to find the strongly connected subgraphs. @@ -327,7 +327,7 @@ void V3Graph::rank(V3EdgeFuncP edgeFuncp) { class GraphAlgRLoops : GraphAlg { private: - vector m_callTrace; // List of everything we hit processing so far + std::vector m_callTrace; // List of everything we hit processing so far bool m_done; // Exit algorithm void main(V3GraphVertex* vertexp) { @@ -460,20 +460,20 @@ struct GraphSortEdgeCmp { void V3Graph::sortVertices() { // Sort list of vertices by rank, then fanout - vector vertices; + std::vector vertices; for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { vertices.push_back(vertexp); } std::stable_sort(vertices.begin(), vertices.end(), GraphSortVertexCmp()); this->verticesUnlink(); - for (vector::iterator it = vertices.begin(); it!=vertices.end(); ++it) { + for (std::vector::iterator it = vertices.begin(); it!=vertices.end(); ++it) { (*it)->verticesPushBack(this); } } void V3Graph::sortEdges() { // Sort edges by rank then fanout of node they point to - vector edges; + std::vector edges; for (V3GraphVertex* vertexp = verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { // Make a vector for (V3GraphEdge* edgep = vertexp->outBeginp(); edgep; edgep = edgep->outNextp()) { @@ -486,7 +486,7 @@ void V3Graph::sortEdges() { // We know the vector contains all of the edges that were // there originally (didn't delete or add) vertexp->outUnlink(); - for (vector::const_iterator it = edges.begin(); it!=edges.end(); ++it) { + for (std::vector::const_iterator it = edges.begin(); it!=edges.end(); ++it) { (*it)->outPushBack(); } // Prep for next diff --git a/src/V3GraphDfa.cpp b/src/V3GraphDfa.cpp index 268df2786..a3db113f6 100644 --- a/src/V3GraphDfa.cpp +++ b/src/V3GraphDfa.cpp @@ -63,8 +63,8 @@ class GraphNfaToDfa : GraphAlg { // Edges from DFA to DFA indicate a completed input transition private: // TYPES - typedef deque DfaStates; - typedef multimap HashMap; + typedef std::deque DfaStates; + typedef std::multimap HashMap; // MEMBERS uint32_t m_step; // Processing step, so we can avoid clearUser all the time @@ -169,7 +169,7 @@ private: // The order of the nodes is not deterministic; the hash thus must not depend on order of edges uint32_t hash = hashDfaOrigins(nfasWithInput); - pair eqrange = m_hashMap.equal_range(hash); + std::pair eqrange = m_hashMap.equal_range(hash); for (HashMap::iterator it = eqrange.first; it != eqrange.second; ++it) { DfaVertex* testp = it->second; if (compareDfaOrigins(nfasWithInput, testp)) { @@ -275,7 +275,7 @@ private: UINFO(9," On dfaState "< inputs; + std::set inputs; // Foreach NFA state (this DFA state was formed from) for (V3GraphEdge* dfaEdgep = dfaStatep->outBeginp(); dfaEdgep; dfaEdgep=dfaEdgep->outNextp()) { if (nfaState(dfaEdgep->top())) { @@ -294,7 +294,7 @@ private: } // Foreach input state (NFA inputs of this DFA state) - for (set::const_iterator inIt=inputs.begin(); inIt!=inputs.end(); ++inIt) { + for (std::set::const_iterator inIt=inputs.begin(); inIt!=inputs.end(); ++inIt) { DfaInput input = *inIt; UINFO(9," ==="<<++i<<"=======================\n"); UINFO(9," On input "<<(void*)(input.toNodep())<userClearVertices(); DfaVertex* startp = graphp()->findStart(); - stack workps; workps.push(startp); + std::stack workps; workps.push(startp); // Mark all nodes connected to start while (!workps.empty()) { @@ -432,7 +432,7 @@ private: m_graphp->userClearVertices(); // Find all dead vertexes - stack workps; + std::stack workps; for (V3GraphVertex* vertexp = m_graphp->verticesBeginp(); vertexp; vertexp=vertexp->verticesNextp()) { if (DfaVertex* vvertexp = dynamic_cast(vertexp)) { workps.push(vvertexp); diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index 0348313d3..bcd9746dc 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -141,10 +141,10 @@ void V3Hashed::dumpFilePrefixed(const string& nameComment, bool tree) { } void V3Hashed::dumpFile(const string& filename, bool tree) { - const vl_unique_ptr logp (V3File::new_ofstream(filename)); + const vl_unique_ptr logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "< dist; + std::map dist; V3Hash lasthash; int num_in_bucket = 0; @@ -165,8 +165,8 @@ void V3Hashed::dumpFile(const string& filename, bool tree) { } *logp <<"\n*** STATS:\n"<::iterator it=dist.begin(); it!=dist.end(); ++it) { - *logp<<" "<first<<" "<second<::iterator it=dist.begin(); it!=dist.end(); ++it) { + *logp<<" "<first<<" "<second<user4p()) nodep->v3fatalSrc("Called findDuplicate on non-hashed node"); - pair eqrange = mmap().equal_range(nodeHash(nodep)); + std::pair eqrange = mmap().equal_range(nodeHash(nodep)); for (HashMmap::iterator eqit = eqrange.first; eqit != eqrange.second; ++eqit) { AstNode* node2p = eqit->second; if (nodep != node2p && sameNodes(nodep, node2p)) { @@ -198,7 +198,7 @@ V3Hashed::iterator V3Hashed::findDuplicate(AstNode* nodep) { V3Hashed::iterator V3Hashed::findDuplicate(AstNode* nodep, V3HashedUserCheck* checkp) { UINFO(8," findD "<user4p()) nodep->v3fatalSrc("Called findDuplicate on non-hashed node"); - pair eqrange = mmap().equal_range(nodeHash(nodep)); + std::pair eqrange = mmap().equal_range(nodeHash(nodep)); for (HashMmap::iterator eqit = eqrange.first; eqit != eqrange.second; ++eqit) { AstNode* node2p = eqit->second; if (nodep != node2p && checkp->check(nodep,node2p) && sameNodes(nodep, node2p)) { diff --git a/src/V3Hashed.h b/src/V3Hashed.h index dbf67c02b..d6bf92279 100644 --- a/src/V3Hashed.h +++ b/src/V3Hashed.h @@ -58,7 +58,7 @@ class V3Hashed : public VHashedBase { AstUser4InUse m_inuser4; // TYPES - typedef multimap HashMmap; + typedef std::multimap HashMmap; public: typedef HashMmap::iterator iterator; private: diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index 75bfb2c8d..3debeffad 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -72,15 +72,15 @@ private: AstNodeModule* m_modp; // Current module V3Double0 m_statUnsup; // Statistic tracking - typedef vector ModVec; + typedef std::vector ModVec; ModVec m_allMods; // All modules, in top-down order. // Within the context of a given module, LocalInstanceMap maps // from child modules to the count of each child's local instantiations. - typedef map LocalInstanceMap; + typedef std::map LocalInstanceMap; // We keep a LocalInstanceMap for each module in the design - map m_instances; + std::map m_instances; // METHODS static int debug() { diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index 910d53529..364bc5070 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -158,7 +158,7 @@ class InstDeModVarVisitor : public AstNVisitor { // Expand all module variables, and save names for later reference private: // STATE - typedef map VarNameMap; + typedef std::map VarNameMap; VarNameMap m_modVarNameMap; // Per module, name of cloned variables static int debug() { @@ -221,7 +221,7 @@ private: int m_instSelNum; // Current instantiation count 0..N-1 InstDeModVarVisitor m_deModVars; // State of variables for current cell module - typedef map VarNameMap; + typedef std::map VarNameMap; static int debug() { static int level = -1; @@ -333,8 +333,8 @@ private: UINFO(4," PIN "<modVarp()->width(); int expwidth = nodep->exprp()->width(); - pair pinDim = nodep->modVarp()->dtypep()->dimensions(false); - pair expDim = nodep->exprp()->dtypep()->dimensions(false); + std::pair pinDim = nodep->modVarp()->dtypep()->dimensions(false); + std::pair expDim = nodep->exprp()->dtypep()->dimensions(false); UINFO(4," PINVAR "<modVarp()<exprp()<second; } @@ -107,8 +108,8 @@ class V3LanguageWords { addKwd("long", "C++ keyword"); addKwd("map", "C++ common word"); addKwd("module", "C++ modules TS keyword"); - addKwd("multimap", "C++ common word"); - addKwd("multiset", "C++ common word"); + addKwd("std::multimap", "C++ common word"); + addKwd("std::multiset", "C++ common word"); addKwd("mutable", "C++ keyword"); addKwd("namespace", "C++ keyword"); addKwd("near", "C++ common word"); diff --git a/src/V3Life.cpp b/src/V3Life.cpp index db105348c..488c30c8f 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -53,7 +53,7 @@ class LifeState { public: V3Double0 m_statAssnDel; // Statistic tracking V3Double0 m_statAssnCon; // Statistic tracking - vector m_unlinkps; + std::vector m_unlinkps; public: // CONSTRUCTORS @@ -61,7 +61,7 @@ public: ~LifeState() { V3Stats::addStatSum("Optimizations, Lifetime assign deletions", m_statAssnDel); V3Stats::addStatSum("Optimizations, Lifetime constant prop", m_statAssnCon); - for (vector::iterator it = m_unlinkps.begin(); it != m_unlinkps.end(); ++it) { + for (std::vector::iterator it = m_unlinkps.begin(); it != m_unlinkps.end(); ++it) { (*it)->unlinkFrBack(); (*it)->deleteTree(); } diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index b690cebf8..8414f4a85 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -105,11 +105,11 @@ public: private: // TYPES - typedef multimap NameScopeSymMap; - typedef map ScopeAliasMap; - typedef set > ImplicitNameSet; - typedef vector IfaceVarSyms; - typedef vector > IfaceModSyms; + typedef std::multimap NameScopeSymMap; + typedef std::map ScopeAliasMap; + typedef std::set > ImplicitNameSet; + typedef std::vector IfaceVarSyms; + typedef std::vector > IfaceModSyms; static LinkDotState* s_errorThisp; // Last self, for error reporting only @@ -135,9 +135,9 @@ public: void dump(const string& nameComment="linkdot", bool force=false) { if (debug()>=6 || force) { string filename = v3Global.debugFilename(nameComment)+".txt"; - const vl_unique_ptr logp (V3File::new_ofstream(filename)); + const vl_unique_ptr logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "<width(),rhs.width()); bit++) { + for (int bit=0; bit < std::max(this->width(),rhs.width()); bit++) { if (this->bitIs1(bit) && rhs.bitIs0(bit)) { return 1; } if (rhs.bitIs1(bit) && this->bitIs0(bit)) { return 0; } if (this->bitIsXZ(bit)) { return 0; } @@ -791,7 +791,7 @@ bool V3Number::isLt(const V3Number& rhs) const { } bool V3Number::isLtXZ(const V3Number& rhs) const { // Include X/Z in comparisons for sort ordering - for (int bit=0; bitwidth(),rhs.width()); bit++) { + for (int bit=0; bit < std::max(this->width(),rhs.width()); bit++) { if (this->bitIs1(bit) && rhs.bitIs0(bit)) { return 1; } if (rhs.bitIs1(bit) && this->bitIs0(bit)) { return 0; } if (this->bitIsXZ(bit)) { return 1; } @@ -1068,9 +1068,9 @@ V3Number& V3Number::opStreamL (const V3Number& lhs, const V3Number& rhs) { m_fileline->v3warn(WIDTHCONCAT,"Unsized numbers/parameters not allowed in streams."); } // Slice size should never exceed the lhs width - int ssize=min(rhs.toUInt(), (unsigned)lhs.width()); + int ssize = std::min(rhs.toUInt(), (unsigned)lhs.width()); for (int istart=0; istartwidth() != rhs.width()) return false; - for (int bit=0; bitwidth(),rhs.width()); bit++) { + for (int bit=0; bit < std::max(this->width(),rhs.width()); bit++) { if (this->bitIs(bit) != rhs.bitIs(bit)) { return false; } } return true; @@ -1165,7 +1165,7 @@ V3Number& V3Number::opCaseEq (const V3Number& lhs, const V3Number& rhs) { V3Number& V3Number::opCaseNeq (const V3Number& lhs, const V3Number& rhs) { // i op j, 1 bit return, max(L(lhs),L(rhs)) calculation, careful need to X/Z extend. char outc = 0; - for (int bit=0; bit - else if (lhs.bitIs1Extend(mbit) && rhs.bitIs0(mbit)) { outc=0; } // - !> + else { // both positive or negative, normal > - for (int bit=0; bit m_value; // The Value, with bit 0 being in bit 0 of this vector (unless X/Z) - vector m_valueX; // Each bit is true if it's X or Z, 10=z, 11=x + std::vector m_value; // The Value, with bit 0 being in bit 0 of this vector (unless X/Z) + std::vector m_valueX; // Each bit is true if it's X or Z, 10=z, 11=x string m_stringVal; // If isString, the value of the string // METHODS V3Number& setSingleBits(char value); @@ -330,6 +330,6 @@ public: V3Number& opLtN (const V3Number& lhs, const V3Number& rhs); V3Number& opLteN (const V3Number& lhs, const V3Number& rhs); }; -inline ostream& operator<<(ostream& os, const V3Number& rhs) { return os< > DirMap; // Directory listing + typedef std::map > DirMap; // Directory listing // STATE - list m_allArgs; // List of every argument encountered - list m_incDirUsers; // Include directories (ordered) - set m_incDirUserSet; // Include directories (for removing duplicates) - list m_incDirFallbacks; // Include directories (ordered) - set m_incDirFallbackSet; // Include directories (for removing duplicates) - map m_langExts; // Language extension map - list m_libExtVs; // Library extensions (ordered) - set m_libExtVSet; // Library extensions (for removing duplicates) + std::list m_allArgs; // List of every argument encountered + std::list m_incDirUsers; // Include directories (ordered) + std::set m_incDirUserSet; // Include directories (for removing duplicates) + std::list m_incDirFallbacks; // Include directories (ordered) + std::set m_incDirFallbackSet; // Include directories (for removing duplicates) + std::map m_langExts; // Language extension map + std::list m_libExtVs; // Library extensions (ordered) + std::set m_libExtVSet; // Library extensions (for removing duplicates) DirMap m_dirMap; // Directory listing // ACCESSOR METHODS @@ -167,9 +167,9 @@ string V3Options::parameter(string name) { void V3Options::checkParameters() { if (!m_parameters.empty()) { - stringstream msg; + std::stringstream msg; msg << "Parameters from the command line were not found in the design:"; - for (map::iterator it = m_parameters.begin(); + for (std::map::iterator it = m_parameters.begin(); it != m_parameters.end(); ++it) { msg << " " << it->first; } @@ -235,7 +235,7 @@ void V3Options::addArg(const string& arg) { string V3Options::allArgsString() { string out; - for (list::iterator it=m_impp->m_allArgs.begin(); it!=m_impp->m_allArgs.end(); ++it) { + for (std::list::iterator it=m_impp->m_allArgs.begin(); it!=m_impp->m_allArgs.end(); ++it) { if (out != "") out += " "; out += *it; } @@ -297,10 +297,10 @@ string V3Options::fileExists (const string& filename) { V3OptionsImp::DirMap::iterator diriter = m_impp->m_dirMap.find(dir); if (diriter == m_impp->m_dirMap.end()) { // Read the listing - m_impp->m_dirMap.insert(make_pair(dir, set() )); + m_impp->m_dirMap.insert(std::make_pair(dir, std::set() )); diriter = m_impp->m_dirMap.find(dir); - set* setp = &(diriter->second); + std::set* setp = &(diriter->second); if (DIR* dirp = opendir(dir.c_str())) { while (struct dirent* direntp = readdir(dirp)) { @@ -311,8 +311,8 @@ string V3Options::fileExists (const string& filename) { } } // Find it - set* filesetp = &(diriter->second); - set::iterator fileiter = filesetp->find(basename); + std::set* filesetp = &(diriter->second); + std::set::iterator fileiter = filesetp->find(basename); if (fileiter == filesetp->end()) { return ""; // Not found } @@ -323,7 +323,7 @@ string V3Options::fileExists (const string& filename) { } string V3Options::filePathCheckOneDir(const string& modname, const string& dirname) { - for (list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { + for (std::list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { string fn = V3Os::filenameFromDirBase(dirname, modname+*extIter); string exists = fileExists(fn); if (exists!="") { @@ -340,12 +340,12 @@ string V3Options::filePath (FileLine* fl, const string& modname, const string& l // Find a filename to read the specified module name, // using the incdir and libext's. // Return "" if not found. - for (list::iterator dirIter=m_impp->m_incDirUsers.begin(); + for (std::list::iterator dirIter=m_impp->m_incDirUsers.begin(); dirIter!=m_impp->m_incDirUsers.end(); ++dirIter) { string exists = filePathCheckOneDir(modname, *dirIter); if (exists!="") return exists; } - for (list::iterator dirIter=m_impp->m_incDirFallbacks.begin(); + for (std::list::iterator dirIter=m_impp->m_incDirFallbacks.begin(); dirIter!=m_impp->m_incDirFallbacks.end(); ++dirIter) { string exists = filePathCheckOneDir(modname, *dirIter); if (exists!="") return exists; @@ -372,16 +372,16 @@ void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) { fl->v3error("This may be because there's no search path specified with -I."<v3error("Looked in:"<::iterator dirIter=m_impp->m_incDirUsers.begin(); + for (std::list::iterator dirIter=m_impp->m_incDirUsers.begin(); dirIter!=m_impp->m_incDirUsers.end(); ++dirIter) { - for (list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { + for (std::list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { string fn = V3Os::filenameFromDirBase(*dirIter,modname+*extIter); fl->v3error(" "<::iterator dirIter=m_impp->m_incDirFallbacks.begin(); + for (std::list::iterator dirIter=m_impp->m_incDirFallbacks.begin(); dirIter!=m_impp->m_incDirFallbacks.end(); ++dirIter) { - for (list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { + for (std::list::iterator extIter=m_impp->m_libExtVs.begin(); extIter!=m_impp->m_libExtVs.end(); ++extIter) { string fn = V3Os::filenameFromDirBase(*dirIter,modname+*extIter); fl->v3error(" "<::iterator it = m_impp->m_langExts.find(ext); + std::map::iterator it = m_impp->m_langExts.find(ext); if (it != m_impp->m_langExts.end()) { return it->second; } @@ -1072,7 +1072,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) { // Read the specified -f filename and process as arguments UINFO(1,"Reading Options File "< ifp (V3File::new_ifstream(filename)); + const vl_unique_ptr ifp (V3File::new_ifstream(filename)); if (ifp->fail()) { fl->v3error("Cannot open -f command file: "+filename); return; @@ -1117,7 +1117,7 @@ void V3Options::parseOptsFile(FileLine* fl, const string& filename, bool rel) { } // Strip off arguments and parse into words - vector args; + std::vector args; string::size_type startpos = 0; while (startpos < whole_file.length()) { while (isspace(whole_file[startpos])) ++startpos; diff --git a/src/V3Options.h b/src/V3Options.h index 510827536..bab1c4380 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -37,12 +37,12 @@ class V3OptionsImp; class FileLine; -typedef vector V3StringList; -typedef set V3StringSet; +typedef std::vector V3StringList; +typedef std::set V3StringSet; class V3Options { // TYPES - typedef map DebugSrcMap; + typedef std::map DebugSrcMap; // MEMBERS (general options) V3OptionsImp* m_impp; // Slow hidden options @@ -58,7 +58,7 @@ class V3Options { V3StringList m_forceIncs; // argument: -FI DebugSrcMap m_debugSrcs; // argument: --debugi-= DebugSrcMap m_dumpTrees; // argument: --dump-treei-= - map m_parameters; // Parameters + std::map m_parameters; // Parameters bool m_preprocOnly; // main switch: -E diff --git a/src/V3Order.cpp b/src/V3Order.cpp index d8be3933e..fe5472efb 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -111,10 +111,10 @@ class OrderMoveDomScope; void OrderGraph::loopsVertexCb(V3GraphVertex* vertexp) { if (debug()) cout<<"-Info-Loop: "<(vertexp)) { - cerr<nodep()->fileline()<<" "<nodep()->typeName()<nodep()->fileline()<<" "<nodep()->typeName()<(vertexp)) { - cerr<varScp()->fileline()<<" "<varScp()->prettyName()<varScp()->fileline()<<" "<varScp()->prettyName()< DomScopeKey; + typedef std::pair DomScopeKey; typedef std::map DomScopeMap; static DomScopeMap s_dsMap; // Structure registered for each dom/scope pairing @@ -171,7 +171,7 @@ public: OrderMoveDomScope::DomScopeMap OrderMoveDomScope::s_dsMap; -inline ostream& operator<< (ostream& lhs, const OrderMoveDomScope& rhs) { +inline std::ostream& operator<< (std::ostream& lhs, const OrderMoveDomScope& rhs) { lhs< m_orderUserps; // All created OrderUser's for later deletion. + std::deque m_orderUserps; // All created OrderUser's for later deletion. // STATE... for inside process AstCFunc* m_pomNewFuncp; // Current function being created int m_pomNewStmts; // Statements in function being created @@ -470,7 +470,7 @@ private: protected: friend class OrderMoveDomScope; V3List m_pomReadyDomScope; // List of ready domain/scope pairs, by loopId - vector m_unoptflatVars; // Vector of variables in UNOPTFLAT loop + std::vector m_unoptflatVars; // Vector of variables in UNOPTFLAT loop private: // STATS @@ -520,7 +520,7 @@ private: void process(); void processCircular(); - typedef deque VertexVec; + typedef std::deque VertexVec; void processInputs(); void processInputsInIterate(OrderEitherVertex* vertexp, VertexVec& todoVec); void processInputsOutIterate(OrderEitherVertex* vertexp, VertexVec& todoVec); @@ -631,31 +631,31 @@ private: m_graph.userClearVertices(); // May be very large vector, so only report the "most important" // elements. Up to 10 of the widest - cerr<varScp()->varp(); - cerr<fileline()<<" "<prettyName()<width()<<", fanout " - <fanout()<fileline()<<" "<prettyName()<width()<<", fanout " + <fanout()<varScp()->varp(); - cerr<fileline()<<" "<prettyName() - <<", width "<width() - <<", fanout "<fanout()<fileline()<<" "<prettyName() + <<", width "<width() + <<", fanout "<fanout()<::iterator it=m_orderUserps.begin(); it!=m_orderUserps.end(); ++it) { + for (std::deque::iterator it=m_orderUserps.begin(); it!=m_orderUserps.end(); ++it) { delete *it; } m_graph.debug(V3Error::debugDefault()); @@ -1262,11 +1262,11 @@ void OrderVisitor::processDomainsIterate(OrderEitherVertex* vertexp) { void OrderVisitor::processEdgeReport() { // Make report of all signal names and what clock edges they have string filename = v3Global.debugFilename("order_edges.txt"); - const vl_unique_ptr logp (V3File::new_ofstream(filename)); + const vl_unique_ptr logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "< report; + std::deque report; for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) { if (OrderVarVertex* vvertexp = dynamic_cast(itp)) { @@ -1275,9 +1275,9 @@ void OrderVisitor::processEdgeReport() { else if (dynamic_cast(itp)) name += " {POST}"; else if (dynamic_cast(itp)) name += " {PORD}"; else if (dynamic_cast(itp)) name += " {STL}"; - ostringstream os; - os.setf(ios::left); - os<<" "<<(void*)(vvertexp->varScp())<<" "<varScp())<<" "<domainp(); if (sentreep) V3EmitV::verilogForTree(sentreep, os); report.push_back(os.str()); @@ -1286,7 +1286,7 @@ void OrderVisitor::processEdgeReport() { *logp<<"Signals and their clock domains:"<::iterator it=report.begin(); it!=report.end(); ++it) { + for (std::deque::iterator it=report.begin(); it!=report.end(); ++it) { *logp<<(*it)<domScopep() == domScopep, "Domain mismatch; list misbuilt?\n"); OrderLogicVertex* lvertexp = vertexp->logicp(); AstScope* scopep = lvertexp->scopep(); - UINFO(5," POSmove l"<domainp(); AstNode* nodep = lvertexp->nodep(); @@ -1634,7 +1634,7 @@ void OrderVisitor::process() { m_graph.dumpDotFilePrefixed("orderg_done"); if (0 && debug()) { string dfilename = v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"_INT_order"; - const vl_unique_ptr logp (V3File::new_ofstream(dfilename)); + const vl_unique_ptr logp (V3File::new_ofstream(dfilename)); if (logp->fail()) v3fatalSrc("Can't write "< > IfaceRefRefs; // Note may have duplicate entries + typedef std::deque > IfaceRefRefs; // Note may have duplicate entries // STATE - typedef map CloneMap; + typedef std::map CloneMap; struct ModInfo { AstNodeModule* m_modp; // Module with specified name CloneMap m_cloneMap; // Map of old-varp -> new cloned varp explicit ModInfo(AstNodeModule* modp) { m_modp=modp; } }; - typedef map ModNameMap; + typedef std::map ModNameMap; ModNameMap m_modNameMap; // Hash of created module flavors by name - typedef map LongMap; + typedef std::map LongMap; LongMap m_longMap; // Hash of very long names to unique identity number int m_longId; - typedef map ValueMap; - typedef map NextValueMap; + typedef std::map ValueMap; + typedef std::map NextValueMap; ValueMap m_valueMap; // Hash of node to param value NextValueMap m_nextValueMap;// Hash of param value to next value to be used - typedef multimap LevelModMap; + typedef std::multimap LevelModMap; LevelModMap m_todoModps; // Modules left to process - typedef deque CellList; + typedef std::deque CellList; CellList m_cellps; // Cells left to process (in this module) AstNodeModule* m_modp; // Current module being processed @@ -120,7 +120,7 @@ private: } void makeSmallNames(AstNodeModule* modp) { - vector usedLetter; usedLetter.resize(256); + std::vector usedLetter; usedLetter.resize(256); // Pass 1, assign first letter to each gparam's name for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp=stmtp->nextp()) { if (AstVar* varp = stmtp->castVar()) { diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 1547cb8d1..0c790aa17 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -53,11 +53,11 @@ int V3ParseSym::s_anonNum = 0; // Read class functions V3ParseImp::~V3ParseImp() { - for (deque::iterator it = m_stringps.begin(); it != m_stringps.end(); ++it) { + for (std::deque::iterator it = m_stringps.begin(); it != m_stringps.end(); ++it) { delete (*it); } m_stringps.clear(); - for (deque::iterator it = m_numberps.begin(); it != m_numberps.end(); ++it) { + for (std::deque::iterator it = m_numberps.begin(); it != m_numberps.end(); ++it) { delete (*it); } m_numberps.clear(); @@ -122,8 +122,8 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i if (v3Global.opt.preprocOnly() || v3Global.opt.keepTempFiles()) { // Create output file with all the preprocessor output we buffered up string vppfilename = v3Global.opt.makeDir()+"/"+v3Global.opt.prefix()+"_"+modname+".vpp"; - ofstream* ofp = NULL; - ostream* osp; + std::ofstream* ofp = NULL; + std::ostream* osp; bool noblanks = v3Global.opt.preprocOnly() && v3Global.opt.preprocNoLine(); if (v3Global.opt.preprocOnly()) { osp = &cout; @@ -134,7 +134,7 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i fileline->v3error("Cannot write preprocessor output: "+vppfilename); return; } else { - for (deque::iterator it = m_ppBuffers.begin(); it!=m_ppBuffers.end(); ++it) { + for (std::deque::iterator it = m_ppBuffers.begin(); it!=m_ppBuffers.end(); ++it) { if (noblanks) { bool blank = true; for (string::iterator its = it->begin(); its != it->end(); ++its) { diff --git a/src/V3ParseImp.h b/src/V3ParseImp.h index 8b5733900..b39d209e7 100644 --- a/src/V3ParseImp.h +++ b/src/V3ParseImp.h @@ -114,10 +114,10 @@ class V3ParseImp { V3ParseBisonYYSType m_curBisonVal; // current token for error reporting V3ParseBisonYYSType m_prevBisonVal; // previous token for error reporting - deque m_stringps; // Created strings for later cleanup - deque m_numberps; // Created numbers for later cleanup - deque m_lintState; // Current lint state for save/restore - deque m_ppBuffers; // Preprocessor->lex buffer of characters to process + std::deque m_stringps; // Created strings for later cleanup + std::deque m_numberps; // Created numbers for later cleanup + std::deque m_lintState; // Current lint state for save/restore + std::deque m_ppBuffers; // Preprocessor->lex buffer of characters to process string m_tag; // Contents (if any) of current verilator tag AstNode* m_tagNodep; // Points to the node to set to m_tag or NULL to not set. diff --git a/src/V3ParseSym.h b/src/V3ParseSym.h index 57e77a69d..bf8f21371 100644 --- a/src/V3ParseSym.h +++ b/src/V3ParseSym.h @@ -33,7 +33,7 @@ class V3ParseSym { // TYPES - typedef vector SymStack; + typedef std::vector SymStack; private: // MEMBERS @@ -124,7 +124,7 @@ public: } UINFO(1,"ParseSym Current: "<nodep()< m_buffers; // Buffer of characters to process + std::deque m_buffers; // Buffer of characters to process int m_ignNewlines; // Ignore multiline newlines bool m_eof; // "EOF" buffer bool m_file; // Buffer is start of new file @@ -152,7 +152,7 @@ private: class V3PreLex { public: // Used only by V3PreLex.cpp and V3PreProc.cpp V3PreProcImp* m_preimpp; // Preprocessor lexor belongs to - stack m_streampStack; // Stack of processing files + std::stack m_streampStack; // Stack of processing files int m_streamDepth; // Depth of stream processing YY_BUFFER_STATE m_bufferState; // Flex state FileLine* m_tokFilelinep; // Starting position of current token diff --git a/src/V3PreLex.l b/src/V3PreLex.l index 618b4481f..e0a64bd0e 100644 --- a/src/V3PreLex.l +++ b/src/V3PreLex.l @@ -504,7 +504,7 @@ void V3PreLex::dumpSummary() { ssize_t left = (yy_n_chars - (yy_c_buf_p -currentBuffer()->yy_ch_buf)); - cout<<" left="< m_args; // List of define arguments + std::vector m_args; // List of define arguments public: string name() const { return m_name; } string params() const { return m_params; } @@ -81,7 +81,7 @@ public: void nextarg(const string& value) { m_nextarg = value; } int parenLevel() const { return m_parenLevel; } void parenLevel(int value) { m_parenLevel = value; } - vector& args() { return m_args; } + std::vector& args() { return m_args; } V3DefineRef(const string& name, const string& params) : m_name(name), m_params(params), m_parenLevel(0) {} ~V3DefineRef() {} @@ -119,7 +119,7 @@ public: // STATE V3PreProc* m_preprocp; ///< Object we're holding data for V3PreLex* m_lexp; ///< Current lexer state (NULL = closed) - stack m_includeStack; ///< Stack of includers above current m_lexp + std::stack m_includeStack; ///< Stack of includers above current m_lexp enum ProcState { ps_TOP, ps_DEFNAME_UNDEF, ps_DEFNAME_DEFINE, @@ -136,7 +136,7 @@ public: return states[s]; }; - stack m_states; ///< Current state of parser + std::stack m_states; ///< Current state of parser int m_off; ///< If non-zero, ifdef level is turned off, don't dump text string m_lastSym; ///< Last symbol name found. string m_formals; ///< Last formals found @@ -158,18 +158,18 @@ public: string m_strify; ///< Text to be stringified // For defines - stack m_defRefs; // Pending definine substitution - stack m_ifdefStack; ///< Stack of true/false emitting evaluations + std::stack m_defRefs; ///< Pending definine substitution + std::stack m_ifdefStack; ///< Stack of true/false emitting evaluations unsigned m_defDepth; ///< How many `defines deep bool m_defPutJoin; ///< Insert `` after substitution // For `` join - stack m_joinStack; ///< Text on lhs of join + std::stack m_joinStack; ///< Text on lhs of join // For getline() string m_lineChars; ///< Characters left for next line - void v3errorEnd(ostringstream& str) { + void v3errorEnd(std::ostringstream& str) { fileline()->v3errorEnd(str); } @@ -561,7 +561,7 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) { string value = defValue(refp->name()); UINFO(4,"defineValue '"< argValueByName; + std::map argValueByName; { // Parse argument list into map unsigned numArgs=0; string argName; @@ -648,7 +648,7 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) { } if (argName != "") { // Found a possible variable substitution - map::iterator iter = argValueByName.find(argName); + std::map::iterator iter = argValueByName.find(argName); if (iter != argValueByName.end()) { // Substitute string subst = iter->second; diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index 39148f680..1715af7be 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -50,9 +50,9 @@ private: AstUser2InUse m_inuser2; // TYPES - typedef map PackageScopeMap; - typedef map, AstVarScope*> VarScopeMap; - typedef set > VarRefScopeSet; + typedef std::map PackageScopeMap; + typedef std::map, AstVarScope*> VarScopeMap; + typedef std::set > VarRefScopeSet; // STATE, inside processing a single module AstNodeModule* m_modp; // Current module diff --git a/src/V3SenTree.h b/src/V3SenTree.h index 03d44d9a0..ddde03808 100644 --- a/src/V3SenTree.h +++ b/src/V3SenTree.h @@ -53,7 +53,7 @@ class SenTreeFinder : public AstNVisitor { private: // STATE AstTopScope* m_topscopep; // Top scope to add statement to - vector m_treesp; // List of sensitive blocks, for folding + std::vector m_treesp; // List of sensitive blocks, for folding // VISITORS static int debug() { @@ -100,7 +100,7 @@ public: // Not the fastest, but there tend to be few clocks AstSenTree* treep = NULL; //sensesp->dumpTree(cout," Lookingfor: "); - for (vector::iterator it = m_treesp.begin(); it!=m_treesp.end(); ++it) { + for (std::vector::iterator it = m_treesp.begin(); it!=m_treesp.end(); ++it) { treep = *it; if (treep) { // Not deleted if (treep->sameTree(sensesp)) { diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 96b6727fb..da67d3769 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -101,13 +101,13 @@ private: int m_dataCount; ///< Bytes of data AstJumpGo* m_jumpp; ///< Jump label we're branching from // Simulating: - deque m_numFreeps; ///< List of all numbers free and not in use - deque m_numAllps; ///< List of all numbers free and in use - deque m_callStack; ///< Call stack for verbose error messages + std::deque m_numFreeps; ///< List of all numbers free and not in use + std::deque m_numAllps; ///< List of all numbers free and in use + std::deque m_callStack; ///< Call stack for verbose error messages // Cleanup // V3Numbers that represents strings are a bit special and the API for V3Number does not allow changing them. - deque m_stringNumbersp; // List of allocated string numbers + std::deque m_stringNumbersp; // List of allocated string numbers // Note level 8&9 include debugging each simulation value @@ -124,7 +124,7 @@ private: } if (AstStructDType* stp = dtypep->castStructDType()) { if (stp->packed()) { - ostringstream out; + std::ostringstream out; out<<"'{"; for (AstMemberDType* itemp = stp->membersp(); itemp; itemp=itemp->nextp()->castMemberDType()) { int width = itemp->width(); @@ -145,7 +145,7 @@ private: } } else if (AstPackArrayDType * arrayp = dtypep->castPackArrayDType()) { if (AstNodeDType * childTypep = arrayp->subDTypep()) { - ostringstream out; + std::ostringstream out; out<<"["; int arrayElements = arrayp->elementsConst(); for (int element = 0; element < arrayElements; ++element) { @@ -181,8 +181,8 @@ public: cout<::iterator it=m_callStack.begin(); it !=m_callStack.end(); ++it) { + std::ostringstream stack; + for (std::deque::iterator it=m_callStack.begin(); it !=m_callStack.end(); ++it) { AstFuncRef* funcp = (*it)->m_funcp; stack<<"\nCalled from:\n"<fileline()<<" "<prettyName()<<"() with parameters:"; V3TaskConnects* tconnects = (*it)->m_tconnects; @@ -959,10 +959,10 @@ public: mainGuts(nodep); } virtual ~SimulateVisitor() { - for (deque::iterator it = m_numAllps.begin(); it != m_numAllps.end(); ++it) { + for (std::deque::iterator it = m_numAllps.begin(); it != m_numAllps.end(); ++it) { delete (*it); } - for (deque::iterator it = m_stringNumbersp.begin(); it != m_stringNumbersp.end(); ++it) { + for (std::deque::iterator it = m_stringNumbersp.begin(); it != m_stringNumbersp.end(); ++it) { delete (*it); } m_stringNumbersp.clear(); diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 9b07949be..98d0de79e 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -224,7 +224,7 @@ private: AstUser4InUse m_inuser4; // TYPES - typedef vector VStack; + typedef std::vector VStack; // STATE bool m_reorder; // Reorder statements vs. just splitting @@ -340,7 +340,7 @@ private: m_graph.weaklyConnected(&SplitEdge::followScoreboard); // Add hard orderings between all nodes of same color, in the order they appeared - vector lastOfColor; lastOfColor.resize(numVertexes); + std::vector lastOfColor; lastOfColor.resize(numVertexes); for (uint32_t i=0; inextp()) { SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p(); @@ -368,8 +368,8 @@ private: AstAlways* splitAlwaysp = nodep->backp()->castAlways(); // Map the rank numbers into nodes they associate with - typedef multimap RankNodeMap; - typedef map ColorRankMap; + typedef std::multimap RankNodeMap; + typedef std::map ColorRankMap; ColorRankMap colorRankMap; uint32_t firstColor = 0; bool multiColors = false; int currOrder = 0; // Existing sequence number of assignment diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 12ef8626c..0c26c7b7f 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -41,7 +41,7 @@ class StatsVisitor : public AstNVisitor { private: // NODE STATE/TYPES - typedef map NameMap; // Number of times a name appears + typedef std::map NameMap; // Number of times a name appears // STATE string m_stage; // Name of the stage we are scanning @@ -55,13 +55,13 @@ private: double m_instrs; // Current instr count (for determining branch direction) bool m_tracingCall; // Iterating into a CCall to a CFunc - vector m_statTypeCount; // Nodes of given type + std::vector m_statTypeCount; // Nodes of given type V3Double0 m_statAbove[AstType::_ENUM_END][AstType::_ENUM_END]; // Nodes of given type V3Double0 m_statPred[AstBranchPred::_ENUM_END]; // Nodes of given type V3Double0 m_statInstr; // Instruction count V3Double0 m_statInstrFast; // Instruction count, non-slow() eval functions only - vector m_statVarWidths; // Variables of given width - vector m_statVarWidthNames; // Var names of given width + std::vector m_statVarWidths; // Variables of given width + std::vector m_statVarWidthNames; // Var names of given width V3Double0 m_statVarArray; // Statistic tracking V3Double0 m_statVarBytes; // Statistic tracking V3Double0 m_statVarClock; // Statistic tracking @@ -246,11 +246,11 @@ public: if (v3Global.opt.statsVars()) { NameMap& nameMapr = m_statVarWidthNames.at(i); for (NameMap::iterator it=nameMapr.begin(); it!=nameMapr.end(); ++it) { - ostringstream os; os<<"Vars, width "<first; + std::ostringstream os; os<<"Vars, width "<first; V3Stats::addStat(m_stage, os.str(), it->second); } } else { - ostringstream os; os<<"Vars, width "<count(); otherp->m_printit = false; diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index 6208d2ea7..3856c7041 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -38,10 +38,10 @@ class StatsReport { // TYPES - typedef vector StatColl; + typedef std::vector StatColl; // STATE - ofstream& os; // Output stream + std::ofstream& os; ///< Output stream static StatColl s_allStats; ///< All statistics void header() { @@ -56,7 +56,7 @@ class StatsReport { void sumit() { // If sumit is set on a statistic, combine with others of same name - typedef multimap ByName; + typedef std::multimap ByName; ByName byName; // * is always first for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) { @@ -79,7 +79,7 @@ class StatsReport { void stars() { // Find all stages size_t maxWidth = 0; - typedef multimap ByName; + typedef std::multimap ByName; ByName byName; // * is always first for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) { @@ -96,7 +96,7 @@ class StatsReport { for (ByName::iterator it = byName.begin(); it!=byName.end(); ++it) { const V3Statistic* repp = it->second; if (repp->perf()) continue; - os<<" "<name(); + os<<" "<name(); repp->dump(os); os<second; if (!repp->perf()) continue; - os<<" "<name(); + os<<" "<name(); repp->dump(os); os< Stages; + typedef std::vector Stages; Stages stages; vl_unordered_map stageInt; - typedef multimap ByName; + typedef std::multimap ByName; ByName byName; // * is always first for (StatColl::iterator it = s_allStats.begin(); it!=s_allStats.end(); ++it) { @@ -140,14 +140,14 @@ class StatsReport { } // Header - os<<" Stat "<name(); + os<<" "<name(); } while (colstage()) { - os<dump(os); @@ -191,7 +191,7 @@ public: } // CONSTRUCTORS - explicit StatsReport(ofstream* aofp) + explicit StatsReport(std::ofstream* aofp) : os(*aofp) { header(); sumit(); @@ -206,11 +206,11 @@ StatsReport::StatColl StatsReport::s_allStats; //###################################################################### // V3Statstic class -void V3Statistic::dump (ofstream& os) const { +void V3Statistic::dump (std::ofstream& os) const { if (perf()) { - os<<" "<fail()) v3fatalSrc("Can't write "<::iterator it = m_entryps.begin(); it != m_entryps.end(); ++it) { + for (std::vector::iterator it = m_entryps.begin(); it != m_entryps.end(); ++it) { (*it)->deleteUnusedAssign(); delete (*it); } diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 6c10fa84a..670a7df5b 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -40,8 +40,8 @@ class VSymEnt; //###################################################################### // Symbol table -typedef set VSymMap; -typedef set VSymConstMap; +typedef std::set VSymMap; +typedef std::set VSymConstMap; class VSymEnt { // Symbol table that can have a "superior" table for resolving upper references @@ -66,9 +66,9 @@ private: static inline int debug() { return 0; } // NOT runtime, too hot of a function #endif public: - void dumpIterate(ostream& os, VSymConstMap& doneSymsr, const string& indent, int numLevels, const string& searchName) const { - os< SymStack; + typedef std::vector SymStack; // MEMBERS VSymEnt* m_symRootp; // Root symbol table @@ -265,7 +265,7 @@ public: // METHODS VSymEnt* rootp() const { return m_symRootp; } // Debug - void dump(ostream& os, const string& indent="") { + void dump(std::ostream& os, const string& indent="") { VSymConstMap doneSyms; os<<"SymEnt Dump:\n"; m_symRootp->dumpIterate(os, doneSyms, indent, 9999, "$root"); @@ -281,7 +281,7 @@ public: if (v3Global.opt.dumpTree()) { string filename = v3Global.debugFilename(nameComment)+".txt"; UINFO(2,"Dumping "< logp (V3File::new_ofstream(filename)); + const vl_unique_ptr logp (V3File::new_ofstream(filename)); if (logp->fail()) v3fatalSrc("Can't write "< m_modTableVscs; // All tables created + std::deque m_modTableVscs; // All tables created // State cleared on each scope AstScope* m_scopep; // Current SCOPE @@ -90,12 +90,12 @@ private: bool m_assignDly; // Consists of delayed assignments instead of normal assignments int m_inWidth; // Input table width int m_outWidth; // Output table width - deque m_inVarps; // Input variable list - deque m_outVarps; // Output variable list - deque m_outNotSet; // True if output variable is not set at some point + std::deque m_inVarps; // Input variable list + std::deque m_outVarps; // Output variable list + std::deque m_outNotSet; // True if output variable is not set at some point // When creating a table - deque m_tableVarps; // Table being created + std::deque m_tableVarps; // Table being created // METHODS static int debug() { @@ -210,7 +210,7 @@ private: // Collapse duplicate tables chgVscp = findDuplicateTable(chgVscp); - for (deque::iterator it = m_tableVarps.begin(); it!=m_tableVarps.end(); ++it) { + for (std::deque::iterator it = m_tableVarps.begin(); it!=m_tableVarps.end(); ++it) { *it = findDuplicateTable(*it); } @@ -232,7 +232,7 @@ private: void createTableVars(AstNode* nodep) { // Create table for each output - for (deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { + for (std::deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { AstVarScope* outvscp = *it; AstVar* outvarp = outvscp->varp(); FileLine* fl = nodep->fileline(); @@ -258,7 +258,7 @@ private: // Concat inputs into a single temp variable (inside always) // First var in inVars becomes the LSB of the concat AstNode* concatp = NULL; - for (deque::iterator it = m_inVarps.begin(); it!=m_inVarps.end(); ++it) { + for (std::deque::iterator it = m_inVarps.begin(); it!=m_inVarps.end(); ++it) { AstVarScope* invscp = *it; AstVarRef* refp = new AstVarRef (nodep->fileline(), invscp, false); if (concatp) { @@ -278,14 +278,14 @@ private: // There may be a simulation path by which the output doesn't change value. // We could bail on these cases, or we can have a "change it" boolean. // We've choosen the later route, since recirc is common in large FSMs. - for (deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { + for (std::deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { m_outNotSet.push_back(false); } uint32_t inValueNextInitArray=0; TableSimulateVisitor simvis (this); for (uint32_t inValue=0; inValue <= VL_MASK_I(m_inWidth); inValue++) { // Make a new simulation structure so we can set new input values - UINFO(8," Simulating "<::iterator it = m_inVarps.begin(); it!=m_inVarps.end(); ++it) { + for (std::deque::iterator it = m_inVarps.begin(); it!=m_inVarps.end(); ++it) { AstVarScope* invscp = *it; // LSB is first variable, so extract it that way simvis.newNumber(invscp, VL_MASK_I(invscp->width()) & (inValue>>shift)); @@ -310,7 +310,7 @@ private: // If a output changed, add it to table int outnum = 0; V3Number outputChgMask (nodep->fileline(), m_outVarps.size(), 0); - for (deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { + for (std::deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { AstVarScope* outvscp = *it; V3Number* outnump = simvis.fetchOutNumberNull(outvscp); AstNode* setp; @@ -345,7 +345,7 @@ private: // See if another table we've created is identical, if so use it for both. // (A more 'modern' way would be to instead use V3Hashed::findDuplicate) AstVar* var1p = vsc1p->varp(); - for (deque::iterator it = m_modTableVscs.begin(); it!=m_modTableVscs.end(); ++it) { + for (std::deque::iterator it = m_modTableVscs.begin(); it!=m_modTableVscs.end(); ++it) { AstVarScope* vsc2p= *it; AstVar* var2p = vsc2p->varp(); if (var1p->width() == var2p->width() @@ -371,7 +371,7 @@ private: // elimination will remove it for us. // Set each output from array ref into our table int outnum = 0; - for (deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { + for (std::deque::iterator it = m_outVarps.begin(); it!=m_outVarps.end(); ++it) { AstVarScope* outvscp = *it; AstNode* alhsp = new AstVarRef(nodep->fileline(), outvscp, true); AstNode* arhsp = new AstArraySel(nodep->fileline(), diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 6acfc86e1..f357241ea 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -109,7 +109,7 @@ private: AstUser4InUse m_inuser4; // TYPES - typedef std::map,AstVarScope*> VarToScopeMap; + typedef std::map,AstVarScope*> VarToScopeMap; // MEMBERS VarToScopeMap m_varToScopeMap; // Map for Var -> VarScope mappings AstAssignW* m_assignwp; // Current assignment @@ -169,7 +169,7 @@ private: if (AstVarScope* vscp = stmtp->castVarScope()) { if (vscp->varp()->isFuncLocal()) { UINFO(9," funcvsc "<varp()), vscp)); + m_varToScopeMap.insert(std::make_pair(std::make_pair(nodep, vscp->varp()), vscp)); } } } @@ -1272,7 +1272,7 @@ V3TaskConnects V3Task::taskConnects(AstNodeFTaskRef* nodep, AstNode* taskStmtsp) // Missing pin/expr? We return (pinvar, NULL) // Extra pin/expr? We clean it up - typedef map NameToIndex; + typedef std::map NameToIndex; NameToIndex nameToIndex; V3TaskConnects tconnects; if (!nodep->taskp()) nodep->v3fatalSrc("unlinked"); diff --git a/src/V3Task.h b/src/V3Task.h index 6dfe86635..d2eecfb65 100644 --- a/src/V3Task.h +++ b/src/V3Task.h @@ -28,8 +28,8 @@ //============================================================================ -typedef pair V3TaskConnect; // [port, pin-connects-to] -typedef vector V3TaskConnects; // [ [port, pin-connects-to] ... ] +typedef std::pair V3TaskConnect; // [port, pin-connects-to] +typedef std::vector V3TaskConnects; // [ [port, pin-connects-to] ... ] //============================================================================ diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index ae0b76ff4..84200bf93 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -207,7 +207,7 @@ private: if (nodep->valuep()) { if (nodep->valuep()->backp() != nodep) nodep->v3fatalSrc("Trace duplicate back needs consistency, so we can map duplicates back to TRACEINCs"); hashed.hash(nodep->valuep()); - UINFO(8, " Hashed "<valuep())<<" "<valuep())<<" "<valuep()) == hashed.end()) { @@ -385,8 +385,8 @@ private: // Form a sorted list of the traces we are interested in UINFO(9,"Making trees\n"); - typedef set ActCodeSet; // All activity numbers applying to a given trace - typedef multimap TraceVec; // For activity set, what traces apply + typedef std::set ActCodeSet; // All activity numbers applying to a given trace + typedef std::multimap TraceVec; // For activity set, what traces apply TraceVec traces; // Form sort structure diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index ae3ebef82..adeabcc08 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -48,7 +48,7 @@ class UndrivenVarEntry { AstVar* m_varp; // Variable this tracks bool m_usedWhole; // True if whole vector used bool m_drivenWhole; // True if whole vector driven - vector m_flags; // Used/Driven on each subbit + std::vector m_flags; // Used/Driven on each subbit enum { FLAG_USED = 0, FLAG_DRIVEN = 1, FLAGS_PER_BIT = 2 }; @@ -235,7 +235,7 @@ private: AstUser2InUse m_inuser2; // STATE - vector m_entryps[3]; // Nodes to delete when we are finished + std::vector m_entryps[3]; // Nodes to delete when we are finished bool m_inBBox; // In black box; mark as driven+used AstNodeFTask* m_taskp; // Current task AstAlways* m_alwaysp; // Current always if combo, otherwise NULL @@ -392,11 +392,11 @@ public: nodep->accept(*this); } virtual ~UndrivenVisitor() { - for (vector::iterator it = m_entryps[1].begin(); it != m_entryps[1].end(); ++it) { + for (std::vector::iterator it = m_entryps[1].begin(); it != m_entryps[1].end(); ++it) { (*it)->reportViolations(); } for (int usr=1; usr<3; ++usr) { - for (vector::iterator it = m_entryps[usr].begin(); it != m_entryps[usr].end(); ++it) { + for (std::vector::iterator it = m_entryps[usr].begin(); it != m_entryps[usr].end(); ++it) { delete (*it); } } diff --git a/src/V3Width.cpp b/src/V3Width.cpp index ca48322e8..6d766d33d 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -87,14 +87,14 @@ //###################################################################### enum Stage { PRELIM=1,FINAL=2,BOTH=3 }; // Numbers are a bitmask <0>=prelim, <1>=final -ostream& operator<<(ostream& str, const Stage& rhs) { return str<<("-PFB"[(int)rhs]); } +std::ostream& operator<<(std::ostream& str, const Stage& rhs) { return str<<("-PFB"[(int)rhs]); } enum Determ { SELF, // Self-determined CONTEXT, // Context-determined ASSIGN // Assignment-like where sign comes from RHS only }; -ostream& operator<<(ostream& str, const Determ& rhs) { +std::ostream& operator<<(std::ostream& str, const Determ& rhs) { static const char* const s_det[] = {"SELF","CNTX","ASSN"}; return str<dump(str); return str; } @@ -180,8 +180,8 @@ public: class WidthVisitor : public AstNVisitor { private: // TYPES - typedef map, AstVar*> TableMap; - typedef map PatVecMap; + typedef std::map, AstVar*> TableMap; + typedef std::map PatVecMap; // STATE WidthVP* m_vup; // Current node state @@ -363,8 +363,8 @@ private: if (nodep->expr1p()->isDouble() || nodep->expr2p()->isDouble()) { nodep->dtypeSetDouble(); } else { - int width = max(nodep->expr1p()->width(), nodep->expr2p()->width()); - int mwidth = max(nodep->expr1p()->widthMin(), nodep->expr2p()->widthMin()); + int width = std::max(nodep->expr1p()->width(), nodep->expr2p()->width()); + int mwidth = std::max(nodep->expr1p()->widthMin(), nodep->expr2p()->widthMin()); bool issigned = nodep->expr1p()->isSigned() && nodep->expr2p()->isSigned(); nodep->dtypeSetLogicSized(width,mwidth,AstNumeric::fromBool(issigned)); } @@ -542,7 +542,7 @@ private: if (m_vup->prelim()) { // Don't need to iterate because V3Const already constified int width = nodep->elementsConst(); - if (width > (1<<28)) nodep->v3error("Width of bit range is huge; vector of over 1billion bits: 0x"< (1<<28)) nodep->v3error("Width of bit range is huge; vector of over 1billion bits: 0x"<littleEndian() && !nodep->backp()->castUnpackArrayDType() && !nodep->backp()->castCell()) { // For cells we warn in V3Inst @@ -907,7 +907,7 @@ private: case AstAttrType::DIM_DIMENSIONS: case AstAttrType::DIM_UNPK_DIMENSIONS: { if (!nodep->fromp() || !nodep->fromp()->dtypep()) nodep->v3fatalSrc("Unsized expression"); - pair dim = nodep->fromp()->dtypep()->dimensions(true); + std::pair dim = nodep->fromp()->dtypep()->dimensions(true); int val = (nodep->attrType()==AstAttrType::DIM_UNPK_DIMENSIONS ? dim.second : (dim.first+dim.second)); nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Signed32(), val)); nodep->deleteTree(); VL_DANGLING(nodep); @@ -921,7 +921,7 @@ private: case AstAttrType::DIM_RIGHT: case AstAttrType::DIM_SIZE: { if (!nodep->fromp() || !nodep->fromp()->dtypep()) nodep->v3fatalSrc("Unsized expression"); - pair dim = nodep->fromp()->dtypep()->skipRefp()->dimensions(true); + std::pair dim = nodep->fromp()->dtypep()->skipRefp()->dimensions(true); uint32_t msbdim = dim.first+dim.second; if (!nodep->dimp() || nodep->dimp()->castConst() || msbdim<1) { int dim = !nodep->dimp() ? 1 : nodep->dimp()->castConst()->toSInt(); @@ -1114,7 +1114,7 @@ private: // However the output width is exactly that requested. // So two steps, first do the calculation's width (max of the two widths) { - int calcWidth = max(width, underDtp->width()); + int calcWidth = std::max(width, underDtp->width()); AstNodeDType* calcDtp = (underDtp->isFourstate() ? nodep->findLogicDType(calcWidth, calcWidth, underDtp->numeric()) : nodep->findBitDType(calcWidth, calcWidth, underDtp->numeric())); @@ -1280,7 +1280,7 @@ private: // Assign missing values V3Number num (nodep->fileline(), nodep->width(), 0); V3Number one (nodep->fileline(), nodep->width(), 1); - map inits; + std::map inits; for (AstEnumItem* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()->castEnumItem()) { if (itemp->valuep()) { if (debug()>=9) { UINFO(0,"EnumInit "<valuep()->dumpTree(cout,"-EnumInit: "); } @@ -1363,8 +1363,8 @@ private: int width = nodep->exprp()->width(); int mwidth = nodep->exprp()->widthMin(); for (AstNode* itemp = nodep->itemsp(); itemp; itemp=itemp->nextp()) { - width = max(width,itemp->width()); - mwidth = max(mwidth,itemp->widthMin()); + width = std::max(width,itemp->width()); + mwidth = std::max(mwidth,itemp->widthMin()); } // Apply width AstNodeDType* subDTypep = nodep->findLogicDType(width,mwidth,nodep->exprp()->dtypep()->numeric()); @@ -1437,7 +1437,7 @@ private: backip = itemp->backp()->castMemberDType(); itemp->lsb(lsb); if (nodep->castUnionDType()) { - width = max(width, itemp->width()); + width = std::max(width, itemp->width()); } else { lsb += itemp->width(); width += itemp->width(); @@ -1704,7 +1704,7 @@ private: // which member each AstPatMember corresponds to before we can // determine the dtypep for that PatMember's value, and then // width the initial value appropriately. - typedef map PatMap; + typedef std::map PatMap; PatMap patmap; { AstMemberDType* memp = classp->membersp(); @@ -1729,7 +1729,7 @@ private: } else if (!memp && patp) { patp->v3error("Assignment pattern contains too many elements"); memp=NULL; patp=NULL; break; } else { - pair ret = patmap.insert(make_pair(memp, patp)); + std::pair ret = patmap.insert(make_pair(memp, patp)); if (!ret.second) { patp->v3error("Assignment pattern contains duplicate entry: " << patp->keyp()->castText()->text()); } @@ -1978,8 +1978,8 @@ private: if (condp->dtypep()->isDouble()) { subDTypep = nodep->findDoubleDType(); } else { - int width = max(subDTypep->width(),condp->width()); - int mwidth = max(subDTypep->widthMin(),condp->widthMin()); + int width = std::max(subDTypep->width(),condp->width()); + int mwidth = std::max(subDTypep->widthMin(),condp->widthMin()); bool issigned = subDTypep->isSigned() && condp->isSigned(); subDTypep = nodep->findLogicDType(width,mwidth,AstNumeric::fromBool(issigned)); } @@ -2676,8 +2676,8 @@ private: if (AstNodeBiop* newp=replaceWithUOrSVersion(nodep, signedFl)) { VL_DANGLING(nodep); nodep = newp; // Process new node instead } - int width = max(nodep->lhsp()->width(), nodep->rhsp()->width()); - int ewidth = max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); + int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width()); + int ewidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); AstNodeDType* subDTypep = nodep->findLogicDType(width, ewidth, AstNumeric::fromBool(signedFl)); iterateCheck(nodep,"LHS",nodep->lhsp(),CONTEXT,FINAL,subDTypep,signedFl?EXTEND_LHS:EXTEND_ZERO); @@ -2846,8 +2846,8 @@ private: userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); checkCvtUS(nodep->lhsp()); checkCvtUS(nodep->rhsp()); - int width = max(nodep->lhsp()->width(), nodep->rhsp()->width()); - int mwidth = max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); + int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width()); + int mwidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); bool expSigned = (nodep->lhsp()->isSigned() && nodep->rhsp()->isSigned()); nodep->dtypeChgWidthSigned(width,mwidth,AstNumeric::fromBool(expSigned)); } @@ -2893,8 +2893,8 @@ private: iterateCheckReal(nodep,"RHS",nodep->rhsp(),FINAL); return; } else { - int width = max(nodep->lhsp()->width(), nodep->rhsp()->width()); - int mwidth = max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); + int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width()); + int mwidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin()); bool expSigned = (nodep->lhsp()->isSigned() && nodep->rhsp()->isSigned()); nodep->dtypeChgWidthSigned(width,mwidth,AstNumeric::fromBool(expSigned)); } @@ -3206,8 +3206,8 @@ private: // IEEE: Signedness is solely determined by the RHS (underp), not by the LHS (expDTypep) if (underp->isSigned() != subDTypep->isSigned() || underp->width() != subDTypep->width()) { - subDTypep = nodep->findLogicDType(max(subDTypep->width(), underp->width()), - max(subDTypep->widthMin(), underp->widthMin()), + subDTypep = nodep->findLogicDType(std::max(subDTypep->width(), underp->width()), + std::max(subDTypep->widthMin(), underp->widthMin()), AstNumeric::fromBool(underp->isSigned())); UINFO(9,"Assignment of opposite-signed RHS to LHS: "<itemsp()) nodep->v3fatalSrc("enum without items"); - vector values; + std::vector values; values.reserve(msbdim+1); for (unsigned i=0; i<(msbdim+1); ++i) { values[i] = NULL; diff --git a/src/Verilator.cpp b/src/Verilator.cpp index b7a02b89a..f9b478583 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -541,7 +541,7 @@ void process () { int main(int argc, char** argv, char** env) { // General initialization - ios::sync_with_stdio(); + std::ios::sync_with_stdio(); time_t randseed; time(&randseed); diff --git a/src/VlcMain.cpp b/src/VlcMain.cpp index 256ad3b1d..1a5a081d9 100644 --- a/src/VlcMain.cpp +++ b/src/VlcMain.cpp @@ -136,7 +136,7 @@ void VlcOptions::showVersion(bool verbose) { int main(int argc, char** argv, char** env) { // General initialization - ios::sync_with_stdio(); + std::ios::sync_with_stdio(); VlcTop top; diff --git a/src/VlcOptions.h b/src/VlcOptions.h index 44d54cc29..cf767d23e 100644 --- a/src/VlcOptions.h +++ b/src/VlcOptions.h @@ -33,8 +33,8 @@ //###################################################################### // V3Options - Command line options -typedef vector VlStringList; -typedef set VlStringSet; +typedef std::vector VlStringList; +typedef std::set VlStringSet; class VlcOptions { // MEMBERS (general options) diff --git a/src/VlcPoint.h b/src/VlcPoint.h index cb3c62802..c3e27458e 100644 --- a/src/VlcPoint.h +++ b/src/VlcPoint.h @@ -85,9 +85,9 @@ public: cout<<" Num, TestsCover, Count, Name"< NameMap; NameMap m_nameMap; //< Name to point-number - vector m_points; //< List of all points + std::vector m_points; //< List of all points vluint64_t m_numPoints; //< Total unique points public: diff --git a/src/VlcSource.h b/src/VlcSource.h index 862d60b14..271e354db 100644 --- a/src/VlcSource.h +++ b/src/VlcSource.h @@ -66,8 +66,8 @@ public: class VlcSource { public: // TYPES - typedef map ColumnMap; // Map of {column} - typedef map LinenoMap; // Map of {lineno}{column} + typedef std::map ColumnMap; // Map of {column} + typedef std::map LinenoMap; // Map of {lineno}{column} private: // MEMBERS @@ -111,7 +111,7 @@ public: class VlcSources { public: // TYPES - typedef map NameMap; + typedef std::map NameMap; private: // MEMBERS NameMap m_sources; //< List of all sources diff --git a/src/VlcTest.h b/src/VlcTest.h index 2bb3cc2e4..c43292fc0 100644 --- a/src/VlcTest.h +++ b/src/VlcTest.h @@ -75,12 +75,12 @@ public: } void dump(bool bucketsToo) { if (testrun() || computrons()!=0.0) { - cout<<" "< ByName; + typedef std::vector ByName; private: // MEMBERS ByName m_tests; //< List of all tests diff --git a/src/VlcTop.cpp b/src/VlcTop.cpp index 2ad7b052c..0162325ba 100644 --- a/src/VlcTop.cpp +++ b/src/VlcTop.cpp @@ -32,7 +32,7 @@ void VlcTop::readCoverage(const string& filename, bool nonfatal) { UINFO(2,"readCoverage "< bytime; + std::vector bytime; for (VlcTests::ByName::iterator it=m_tests.begin(); it!=m_tests.end(); ++it) { VlcTest* testp = *it; if (testp->bucketsCovered()) { // else no points, so can't help us @@ -122,7 +122,7 @@ void VlcTop::rank() { if (debug()) { UINFO(9,"Left on iter"<::iterator it=bytime.begin(); it!=bytime.end(); ++it) { + for (std::vector::iterator it=bytime.begin(); it!=bytime.end(); ++it) { VlcTest* testp = *it; if (!testp->rank()) { vluint64_t remain = testp->buckets().dataPopCount(remaining); @@ -188,7 +188,7 @@ void VlcTop::annotateCalcNeeded() { } float pct = totCases ? (100*totOk / totCases) : 0; cout<<"Total coverage ("< "<second; //UINFO(0,"Source "< #include #include +#include +#include -using namespace std; +// Avoid needing std:: prefixes on some very common items +typedef std::string string; +using std::cout; +using std::endl; +using std::make_pair; //********************************************************************** //**** Configure-discovered library options