diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index bc600a599..74fe85b6e 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1405,7 +1405,7 @@ public: virtual string name() const { return m_name; } // * = Scope name virtual void name(const string& name) { m_name = name; } string nameDotless() const; - string nameVlSym() const { return (((string)"vlSymsp->") + nameDotless()); } + string nameVlSym() const { return ((string("vlSymsp->")) + nameDotless()); } AstNodeModule* modp() const { return m_modp; } void addVarp(AstNode* nodep) { addOp1p(nodep); } AstNode* varsp() const { return op1p(); } // op1 = AstVarScope's @@ -2585,8 +2585,8 @@ public: ASTNODE_NODE_FUNCS(Display) 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()); } + virtual string verilogKwd() const { return (filep() ? string("$f")+string(displayType().ascii()) + : string("$")+string(displayType().ascii())); } virtual bool isGateOptimizable() const { return false; } virtual bool isPredictOptimizable() const { return false; } virtual bool isPure() const { return false; } // SPECIAL: $display has 'visual' ordering diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index ba169d570..139040816 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -197,7 +197,7 @@ private: // To keep correct visual order, must add before other Text's AstNode* afterp = nodep->scopeAttrp(); if (afterp) afterp->unlinkFrBackWithNext(); - nodep->scopeAttrp(new AstText(nodep->fileline(), (string)"__DOT__"+m_namedScope)); + nodep->scopeAttrp(new AstText(nodep->fileline(), string("__DOT__")+m_namedScope)); if (afterp) nodep->scopeAttrp(afterp); } iterateChildren(nodep); diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index 7ace2db48..870bc60fc 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -75,7 +75,7 @@ private: if (vscp->user1p()) return ((AstVarScope*)vscp->user1p()); AstVar* varp = vscp->varp(); if (!varp->width1()) varp->v3error("Unsupported: Clock edge on non-single bit signal: "<prettyName()); - string newvarname = ((string)"__Vclklast__"+vscp->scopep()->nameDotless()+"__"+varp->name()); + string newvarname = (string("__Vclklast__")+vscp->scopep()->nameDotless()+"__"+varp->name()); AstVar* newvarp = new AstVar(vscp->fileline(), AstVarType::MODULETEMP, newvarname, VFlagLogicPacked(), 1); newvarp->noReset(true); // Reset by below assign m_modp->addStmtp(newvarp); diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 6caccf26d..a18f1eb94 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1075,8 +1075,8 @@ private: if (!m_modp) nodep->v3fatalSrc("Not under module"); // We could create just one temp variable, but we'll get better optimization // if we make one per term. - string name1 = ((string)"__Vconcswap"+cvtToStr(m_modp->varNumGetInc())); - string name2 = ((string)"__Vconcswap"+cvtToStr(m_modp->varNumGetInc())); + string name1 = (string("__Vconcswap")+cvtToStr(m_modp->varNumGetInc())); + string name2 = (string("__Vconcswap")+cvtToStr(m_modp->varNumGetInc())); AstVar* temp1p = new AstVar(sel1p->fileline(), AstVarType::BLOCKTEMP, name1, VFlagLogicPacked(), msb1-lsb1+1); AstVar* temp2p = new AstVar(sel2p->fileline(), AstVarType::BLOCKTEMP, name2, diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index 8f5275b9f..7e27a1197 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -162,7 +162,7 @@ private: // We'll do this, and make the if(...) coverinc later. // Add signal to hold the old value - string newvarname = (string)"__Vtogcov__"+nodep->shortName(); + string newvarname = string("__Vtogcov__")+nodep->shortName(); AstVar* chgVarp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP, newvarname, nodep); chgVarp->fileline()->modifyWarnOff(V3ErrorCode::UNUSED, true); m_modp->addStmtp(chgVarp); diff --git a/src/V3Depth.cpp b/src/V3Depth.cpp index 0f54046c3..b590dfcc1 100644 --- a/src/V3Depth.cpp +++ b/src/V3Depth.cpp @@ -58,7 +58,7 @@ private: UINFO(6," Deep "<=9) nodep->dumpTree(cout,"deep:"); - string newvarname = ((string)"__Vdeeptemp"+cvtToStr(m_modp->varNumGetInc())); + string newvarname = (string("__Vdeeptemp")+cvtToStr(m_modp->varNumGetInc())); AstVar* varp = new AstVar(nodep->fileline(), AstVarType::STMTTEMP, newvarname, // Width, not widthMin, as we may be in middle of BITSEL expression which // though it's one bit wide, needs the mask in the upper bits. diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index d95aded86..3d86a49dd 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -233,7 +233,7 @@ public: nodep->v3fatalSrc("Case statements should have been reduced out"); } virtual void visit(AstComment* nodep) { - putsDecoration((string)"// "+nodep->name()+" at "+nodep->fileline()->ascii()+"\n"); + putsDecoration(string("// ")+nodep->name()+" at "+nodep->fileline()->ascii()+"\n"); iterateChildren(nodep); } virtual void visit(AstCoverDecl* nodep) { @@ -776,7 +776,7 @@ public: virtual void visit(AstCFile*) {} // Handled outside the Visit class // Default virtual void visit(AstNode* nodep) { - puts((string)"\n???? // "+nodep->prettyTypeName()+"\n"); + puts(string("\n???? // ")+nodep->prettyTypeName()+"\n"); iterateChildren(nodep); nodep->v3fatalSrc("Unknown node type reached emitter: "<prettyTypeName()); } diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index f4630ac9d..8bbea2670 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -299,7 +299,7 @@ void EmitCSyms::emitSymHdr() { } puts("\n// SYMS CLASS\n"); - puts((string)"class "+symClassName()+" : public VerilatedSyms {\n"); + puts(string("class ")+symClassName()+" : public VerilatedSyms {\n"); ofp()->putsPrivate(false); // public: puts("\n// LOCAL STATE\n"); @@ -340,7 +340,7 @@ void EmitCSyms::emitSymHdr() { puts("\n// CREATORS\n"); puts(symClassName()+"("+topClassName()+"* topp, const char* namep);\n"); - puts((string)"~"+symClassName()+"() {}\n"); + puts(string("~")+symClassName()+"() {}\n"); puts("\n// METHODS\n"); puts("inline const char* name() { return __Vm_namep; }\n"); diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index ffb7a422e..1d25a5dee 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -194,7 +194,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { putqs(nodep,"end\n"); } virtual void visit(AstComment* nodep) { - puts((string)"// "+nodep->name()+"\n"); + puts(string("// ")+nodep->name()+"\n"); iterateChildren(nodep); } virtual void visit(AstContinue* nodep) { @@ -595,7 +595,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor { virtual void visit(AstCell*) {} // Handled outside the Visit class // Default virtual void visit(AstNode* nodep) { - puts((string)"\n???? // "+nodep->prettyTypeName()+"\n"); + puts(string("\n???? // ")+nodep->prettyTypeName()+"\n"); iterateChildren(nodep); // Not v3fatalSrc so we keep processing nodep->v3error("Internal: Unknown node type reached emitter: "<prettyTypeName()); diff --git a/src/V3Error.cpp b/src/V3Error.cpp index db3575113..a56d76db0 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -130,8 +130,8 @@ string V3Error::msgPrefix() { else if (code==V3ErrorCode::EC_FATAL) return "%Error: "; else if (code==V3ErrorCode::EC_FATALSRC) return "%Error: Internal Error: "; else if (code==V3ErrorCode::EC_ERROR) return "%Error: "; - else if (isError(code, supp)) return "%Error-"+(string)code.ascii()+": "; - else return "%Warning-"+(string)code.ascii()+": "; + else if (isError(code, supp)) return "%Error-"+string(code.ascii())+": "; + else return "%Warning-"+string(code.ascii())+": "; } //====================================================================== diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 5f608459b..38cc42689 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -99,7 +99,7 @@ FileLine::FileLine(FileLine::EmptySecret) { string FileLine::lineDirectiveStrg(int enterExit) const { char numbuf[20]; sprintf(numbuf, "%d", lineno()); char levelbuf[20]; sprintf(levelbuf, "%d", enterExit); - return ((string)"`line "+numbuf+" \""+filename()+"\" "+levelbuf+"\n"); + return (string("`line ")+numbuf+" \""+filename()+"\" "+levelbuf+"\n"); } void FileLine::lineDirective(const char* textp, int& enterExitRef) { diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index c722f3370..32fb3ff10 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -438,11 +438,11 @@ private: // To keep correct visual order, must add before other Text's AstNode* afterp = nodep->scopeAttrp(); if (afterp) afterp->unlinkFrBackWithNext(); - nodep->scopeAttrp(new AstText(nodep->fileline(), (string)"__DOT__"+m_cellp->name())); + nodep->scopeAttrp(new AstText(nodep->fileline(), string("__DOT__")+m_cellp->name())); if (afterp) nodep->scopeAttrp(afterp); afterp = nodep->scopeEntrp(); if (afterp) afterp->unlinkFrBackWithNext(); - nodep->scopeEntrp(new AstText(nodep->fileline(), (string)"__DOT__"+m_cellp->name())); + nodep->scopeEntrp(new AstText(nodep->fileline(), string("__DOT__")+m_cellp->name())); if (afterp) nodep->scopeEntrp(afterp); iterateChildren(nodep); } diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index 517b5018b..6f1e3e463 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -513,7 +513,7 @@ public: // Make a new temp wire //if (1||debug()>=9) { pinp->dumpTree(cout,"-in_pin:"); } AstNode* pinexprp = pinp->exprp()->unlinkFrBack(); - string newvarname = ((string)(pinVarp->isOutput() ? "__Vcellout" : "__Vcellinp") + string newvarname = (string(pinVarp->isOutput() ? "__Vcellout" : "__Vcellinp") +(forTristate?"t":"") // Prevent name conflict if both tri & non-tri add signals +"__"+cellp->name()+"__"+pinp->name()); AstVar* newvarp = new AstVar(pinVarp->fileline(), AstVarType::MODULETEMP, newvarname, pinVarp); diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index 4d7e5070e..bd859cf25 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -91,7 +91,7 @@ void V3LinkLevel::wrapTop(AstNetlist* netlistp) { // We do ONLY the top module AstNodeModule* oldmodp = netlistp->modulesp(); if (!oldmodp) netlistp->v3fatalSrc("No module found to process"); - AstNodeModule* newmodp = new AstModule(oldmodp->fileline(), (string)"TOP_"+oldmodp->name()); + AstNodeModule* newmodp = new AstModule(oldmodp->fileline(), string("TOP_")+oldmodp->name()); // Make the new module first in the list oldmodp->unlinkFrBackWithNext(); newmodp->addNext(oldmodp); diff --git a/src/V3Name.cpp b/src/V3Name.cpp index 5a8dafa7a..fbfe6ede8 100644 --- a/src/V3Name.cpp +++ b/src/V3Name.cpp @@ -57,13 +57,13 @@ private: void rename(AstNode* nodep, bool addPvt) { if (!nodep->user1()) { // Not already done if (addPvt) { - string newname = (string)"__PVT__"+nodep->name(); + string newname = string("__PVT__")+nodep->name(); nodep->name(newname); } else { string rsvd = m_words.isKeyword(nodep->name()); if (rsvd != "") { nodep->v3warn(SYMRSVDWORD,"Symbol matches "+rsvd+": '"<prettyName()<<"'"); - string newname = (string)"__SYM__"+nodep->name(); + string newname = string("__SYM__")+nodep->name(); nodep->name(newname); } } diff --git a/src/V3Param.cpp b/src/V3Param.cpp index e9a2ec6aa..d258c193f 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -165,7 +165,7 @@ private: int num = bucket + offset * BUCKETS; m_valueMap.insert(make_pair(nodep, num)); // 'z' just to make sure we don't collide with a normal non-hashed number - return (string)"z"+cvtToStr(num); + return string("z")+cvtToStr(num); } } void collectPins(CloneMap* clonemapp, AstNodeModule* modp) { diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 6283a9193..1a0d4405a 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -106,7 +106,7 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i // intervening +ext+ options since it was first ecountered. FileLine *modfileline = new FileLine(modfilename, 0); modfileline->language(v3Global.opt.fileLanguage(modfilename)); - ppPushText((string)"`begin_keywords \""+modfileline->language().ascii()+"\"\n"); + ppPushText(string("`begin_keywords \"")+modfileline->language().ascii()+"\"\n"); } // Preprocess into m_ppBuffer diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 4deacc203..b39c27c18 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -999,7 +999,7 @@ int V3PreProcImp::getStateToken() { break; } else { - error((string)"Expecting define name. Found: "+tokenName(tok)+"\n"); + error(string("Expecting define name. Found: ")+tokenName(tok)+"\n"); goto next_tok; } } @@ -1015,7 +1015,7 @@ int V3PreProcImp::getStateToken() { if (!m_off) return tok; else goto next_tok; } else { - error((string)"Expecting define formal arguments. Found: "+tokenName(tok)+"\n"); + error(string("Expecting define formal arguments. Found: ")+tokenName(tok)+"\n"); goto next_tok; } } @@ -1068,7 +1068,7 @@ int V3PreProcImp::getStateToken() { } else { if (m_defRefs.empty()) fatalSrc("Shouldn't be in DEFPAREN w/o active defref"); V3DefineRef* refp = &(m_defRefs.top()); - error((string)"Expecting ( to begin argument list for define reference `"+refp->name()+"\n"); + error(string("Expecting ( to begin argument list for define reference `")+refp->name()+"\n"); statePop(); goto next_tok; } @@ -1132,7 +1132,7 @@ int V3PreProcImp::getStateToken() { statePush(ps_STRIFY); goto next_tok; } else { - error((string)"Expecting ) or , to end argument list for define reference. Found: "+tokenName(tok)); + error(string("Expecting ) or , to end argument list for define reference. Found: ")+tokenName(tok)); statePop(); goto next_tok; } @@ -1161,7 +1161,7 @@ int V3PreProcImp::getStateToken() { } else { statePop(); - error((string)"Expecting include filename. Found: "+tokenName(tok)+"\n"); + error(string("Expecting include filename. Found: ")+tokenName(tok)+"\n"); goto next_tok; } } @@ -1175,7 +1175,7 @@ int V3PreProcImp::getStateToken() { goto next_tok; } else { - error((string)"Expecting `error string. Found: "+tokenName(tok)+"\n"); + error(string("Expecting `error string. Found: ")+tokenName(tok)+"\n"); statePop(); goto next_tok; } @@ -1217,7 +1217,7 @@ int V3PreProcImp::getStateToken() { while ((pos=out.find("\n")) != string::npos) { out.replace(pos, 1, " "); } - unputString((string)"\""+out+"\""); + unputString(string("\"")+out+"\""); statePop(); goto next_tok; } @@ -1386,7 +1386,7 @@ int V3PreProcImp::getStateToken() { case VP_DEFFORM: // Handled by state=ps_DEFFORM; case VP_DEFVALUE: // Handled by state=ps_DEFVALUE; default: - fatalSrc((string)"Internal error: Unexpected token "+tokenName(tok)+"\n"); + fatalSrc(string("Internal error: Unexpected token ")+tokenName(tok)+"\n"); break; } return tok; diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index f2ef3199b..7b2ab8b93 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -151,7 +151,7 @@ private: } AstVar* getBlockTemp(AstNode* nodep) { - string newvarname = ((string)"__Vtemp"+cvtToStr(m_modp->varNumGetInc())); + string newvarname = (string("__Vtemp")+cvtToStr(m_modp->varNumGetInc())); AstVar* varp = new AstVar(nodep->fileline(), AstVarType::STMTTEMP, newvarname, nodep->dtypep()); m_funcp->addInitsp(varp); diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index 79667dd75..61b9d2998 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -268,7 +268,7 @@ private: } virtual void visit(AstScopeName* nodep) { // If there's a %m in the display text, we add a special node that will contain the name() - string prefix = (string)("__DOT__")+m_scopep->name(); + string prefix = string("__DOT__")+m_scopep->name(); // TOP and above will be the user's name(). // Note 'TOP.' is stripped by scopePrettyName // To keep correct visual order, must add before other Text's diff --git a/src/V3Split.cpp b/src/V3Split.cpp index d56135c3e..4ff81a567 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -152,7 +152,7 @@ public: SplitVarPostVertex(V3Graph* graphp, AstNode* nodep) : SplitNodeVertex(graphp,nodep) {} virtual ~SplitVarPostVertex() {} - virtual string name() const { return (string)"POST "+SplitNodeVertex::name(); } + virtual string name() const { return string("POST ")+SplitNodeVertex::name(); } virtual string dotColor() const { return "CadetBlue"; } }; @@ -526,10 +526,10 @@ protected: // And a real ordering to get the statements into something reasonable // We don't care if there's cutable violations here... // Non-cutable violations should be impossible; as those edges are program-order - if (debug()>=9) m_graph.dumpDotFilePrefixed((string)"splitg_preo", false); + if (debug()>=9) m_graph.dumpDotFilePrefixed(string("splitg_preo"), false); m_graph.acyclic(&SplitEdge::followCyclic); m_graph.rank(&SplitEdge::followCyclic); // Or order(), but that's more expensive - if (debug()>=9) m_graph.dumpDotFilePrefixed((string)"splitg_opt", false); + if (debug()>=9) m_graph.dumpDotFilePrefixed(string("splitg_opt"), false); } void reorderBlock(AstNode* nodep) { diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 2959b1c69..573a51186 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -359,7 +359,7 @@ private: // outvscp is the variable for functions only, if NULL, it's a task if (!refp->taskp()) refp->v3fatalSrc("Unlinked?"); AstNode* newbodysp = AstNode::cloneTreeNull(refp->taskp()->stmtsp(), true); // Maybe NULL - AstNode* beginp = new AstComment(refp->fileline(), (string)("Function: ")+refp->name()); + AstNode* beginp = new AstComment(refp->fileline(), string("Function: ")+refp->name()); if (newbodysp) beginp->addNext(newbodysp); if (debug()>=9) { beginp->dumpTreeAndNext(cout,"-newbegi:"); } // @@ -470,7 +470,7 @@ private: AstCFunc* cfuncp = m_statep->ftaskCFuncp(refp->taskp()); if (!cfuncp) refp->v3fatalSrc("No non-inline task associated with this task call?"); // - AstNode* beginp = new AstComment(refp->fileline(), (string)("Function: ")+refp->name()); + AstNode* beginp = new AstComment(refp->fileline(), string("Function: ")+refp->name()); AstCCall* ccallp = new AstCCall(refp->fileline(), cfuncp, NULL); beginp->addNext(ccallp); // Convert complicated outputs to temp signals diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 2b0c6adb3..2dc054c36 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -93,7 +93,7 @@ public: } virtual string name() const { if (activityAlways()) return "*ALWAYS*"; - else return ((string)(slow()?"*SLOW* ":""))+insertp()->name(); + else return (string(slow()?"*SLOW* ":""))+insertp()->name(); } virtual string dotColor() const { return slow()?"yellowGreen":"green"; } bool activityCodeValid() const { return m_activityCodeValid; } diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 4387eba3f..50595587a 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -119,7 +119,7 @@ private: replaceHandle.relink(newp); } else { - string name = ((string)"__Vlvbound"+cvtToStr(m_modp->varNumGetInc())); + string name = (string("__Vlvbound")+cvtToStr(m_modp->varNumGetInc())); AstVar* varp = new AstVar(fl, AstVarType::MODULETEMP, name, prep->dtypep()); m_modp->addStmtp(varp); @@ -287,7 +287,7 @@ private: // Make a Vxrand variable // We use the special XTEMP type so it doesn't break pure functions if (!m_modp) nodep->v3fatalSrc("X number not under module"); - string newvarname = ((string)"__Vxrand" + string newvarname = (string("__Vxrand") +cvtToStr(m_modp->varNumGetInc())); AstVar* newvarp = new AstVar(nodep->fileline(), AstVarType::XTEMP, newvarname, diff --git a/src/verilog.y b/src/verilog.y index 36c67e273..207e96474 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -201,7 +201,7 @@ int V3ParseGrammar::s_modTypeImpNum = 0; static void ERRSVKWD(FileLine* fileline, const string& tokname) { static int toldonce = 0; - fileline->v3error((string)"Unexpected \""+tokname+"\": \""+tokname+"\" is a SystemVerilog keyword misused as an identifier."); + fileline->v3error(string("Unexpected \"")+tokname+"\": \""+tokname+"\" is a SystemVerilog keyword misused as an identifier."); if (!toldonce++) fileline->v3error("Modify the Verilog-2001 code to avoid SV keywords, or use `begin_keywords or --language."); }