diff --git a/include/verilated.cpp b/include/verilated.cpp index 77ff0944f..12da6a49a 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -706,10 +706,10 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf _vl_vsss_skipspace(fp,floc,fromp,fstr); _vl_vsss_read(fp,floc,fromp,fstr, tmp, NULL); if (!tmp[0]) goto done; - int pos = ((int)strlen(tmp))-1; + int lpos = ((int)strlen(tmp))-1; int lsb = 0; - for (int i=0; i=0; --pos) { - _vl_vsss_setbit(owp,obits,lsb, 8, tmp[pos]); lsb+=8; + for (int i=0; i=0; --lpos) { + _vl_vsss_setbit(owp,obits,lsb, 8, tmp[lpos]); lsb+=8; } break; } @@ -1186,9 +1186,9 @@ IData VL_VALUEPLUSARGS_INW(int rbits, const string& ld, WDataOutP rwp) { VL_ZERO_RESET_W(rbits, rwp); switch (tolower(fmt)) { case 'd': - vlsint64_t ld; - sscanf(dp,"%30" VL_PRI64 "d",&ld); - VL_SET_WQ(rwp,ld); + vlsint64_t lld; + sscanf(dp,"%30" VL_PRI64 "d",&lld); + VL_SET_WQ(rwp,lld); break; case 'b': _vl_vsss_based(rwp,rbits, 1, dp, 0, (int)strlen(dp)); diff --git a/include/verilated.h b/include/verilated.h index 829f6c866..731a52837 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -1726,7 +1726,7 @@ static inline WDataOutP VL_SHIFTRS_WWW(int obits,int lbits,int rbits,WDataOutP o if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more int lmsw = VL_WORDS_I(obits)-1; IData sign = VL_SIGNONES_I(lbits,lwp[lmsw]); - for (int i=0; i <= lmsw; ++i) owp[i] = sign; + for (int j=0; j <= lmsw; ++j) owp[j] = sign; owp[lmsw] &= VL_MASK_I(lbits); return owp; } diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index e491d3ec5..cf3afba3d 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -338,8 +338,8 @@ private: if (vscp->user1() == 0) { UINFO(4," Dead "< eqrange = m_assignMap.equal_range(vscp); - for (AssignMap::iterator it = eqrange.first; it != eqrange.second; ++it) { - AstNodeAssign* assp = it->second; + for (AssignMap::iterator itr = eqrange.first; itr != eqrange.second; ++itr) { + AstNodeAssign* assp = itr->second; UINFO(4," Dead assign "<dtypep()->user1Inc(-1); assp->unlinkFrBack()->deleteTree(); VL_DANGLING(assp); diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index ba77d9d84..7bd4f3233 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -112,8 +112,8 @@ 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 it = m_scopes.begin(); it != m_scopes.end(); ++it) { - AstScope* scopep = it->first; AstNodeModule* smodp = it->second; + for (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) { AstNodeModule* modp = it->first; AstVar* varp = it->second; @@ -124,10 +124,10 @@ class EmitCSyms : EmitCBaseVisitor { string scpName; string varBase; if (whole.substr(0,10) == "__DOT__TOP") whole.replace(0,10,""); - string::size_type pos = whole.rfind("__DOT__"); - if (pos != string::npos) { - scpName = whole.substr(0,pos); - varBase = whole.substr(pos+strlen("__DOT__")); + string::size_type dpos = whole.rfind("__DOT__"); + if (dpos != string::npos) { + scpName = whole.substr(0,dpos); + varBase = whole.substr(dpos+strlen("__DOT__")); } else { varBase = whole; } diff --git a/src/V3File.cpp b/src/V3File.cpp index 7d2391aba..a65402449 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -608,21 +608,22 @@ bool V3OutFormatter::tokenEnd(const char* cp) { int V3OutFormatter::endLevels (const char *strg) { int levels=m_indentLevel; - const char* cp=strg; - while (isspace(*cp)) cp++; - switch (*cp) { - case '\n': // Newlines.. No need for whitespace before it - return (0); - case '#': // Preproc directive - return (0); - } { - // label/public/private: Deindent by 2 spaces - const char* mp=cp; - for (; isalnum(*mp); mp++) ; - if (mp[0]==':' && mp[1]!=':') return (levels-m_blockIndent/2); + const char* cp=strg; + while (isspace(*cp)) cp++; + switch (*cp) { + case '\n': // Newlines.. No need for whitespace before it + return (0); + case '#': // Preproc directive + return (0); + } + { + // label/public/private: Deindent by 2 spaces + const char* mp=cp; + for (; isalnum(*mp); mp++) ; + if (mp[0]==':' && mp[1]!=':') return (levels-m_blockIndent/2); + } } - // We want "} else {" to be one level to the left of normal for (const char* cp=strg; *cp; cp++) { switch (*cp) { diff --git a/src/V3GraphDfa.cpp b/src/V3GraphDfa.cpp index cd46ac106..37880d33d 100644 --- a/src/V3GraphDfa.cpp +++ b/src/V3GraphDfa.cpp @@ -257,11 +257,11 @@ private: // Find epsilon closure of this nfa node, and destinations to work list for (V3GraphEdge* nfaEdgep = nfaStatep->outBeginp(); nfaEdgep; nfaEdgep=nfaEdgep->outNextp()) { DfaEdge* cNfaEdgep = static_cast(nfaEdgep); - DfaVertex* nfaStatep = static_cast(nfaEdgep->top()); + DfaVertex* ecNfaStatep = static_cast(nfaEdgep->top()); //UINFO(9," Consider "<top()<<" EP "<epsilon()<epsilon() - && unseenNfaThisStep(nfaStatep)) { // Not processed? - workps.push_back(nfaStatep); + && unseenNfaThisStep(ecNfaStatep)) { // Not processed? + workps.push_back(ecNfaStatep); } } } diff --git a/src/V3GraphTest.cpp b/src/V3GraphTest.cpp index 572773855..74dbde002 100644 --- a/src/V3GraphTest.cpp +++ b/src/V3GraphTest.cpp @@ -251,7 +251,7 @@ public: // Outbound are cutable, as we may need to evaluate multiple times { - V3GraphTestVertex* n = new V3GraphTestVertex(gp,"c=a|b|i"); + n = new V3GraphTestVertex(gp,"c=a|b|i"); new V3GraphEdge(gp, n, c, 1, true); new V3GraphEdge(gp, a, n, 1, false); new V3GraphEdge(gp, b, n, 1, false); diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index a8342fffd..d1cd49ae7 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -568,24 +568,24 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) { //UINFO(4," Parse Paren="<args().size() > numArgs) { // A call `def( a ) must be equivelent to `def(a ), so trimWhitespace // At one point we didn't trim trailing whitespace, but this confuses `" string arg = trimWhitespace(refp->args()[numArgs], true); - if (arg != "") value = arg; + if (arg != "") valueDef = arg; } else if (!haveDefault) { error("Define missing argument '"+argName+"' for: "+refp->name()+"\n"); return " `"+refp->name()+" "; } numArgs++; } - argValueByName[argName] = value; + argValueByName[argName] = valueDef; // Prepare for next argName = ""; token = ""; diff --git a/src/VlcMain.cpp b/src/VlcMain.cpp index d02f1821a..51c8b0147 100644 --- a/src/VlcMain.cpp +++ b/src/VlcMain.cpp @@ -147,10 +147,12 @@ int main(int argc, char** argv, char** env) { top.opt.addReadFile("vlt_coverage.pl"); } - const VlStringSet& readFiles = top.opt.readFiles(); - for (VlStringSet::iterator it = readFiles.begin(); it != readFiles.end(); ++it) { - string filename = *it; - top.readCoverage(filename); + { + const VlStringSet& readFiles = top.opt.readFiles(); + for (VlStringSet::iterator it = readFiles.begin(); it != readFiles.end(); ++it) { + string filename = *it; + top.readCoverage(filename); + } } if (debug() >= 9) { diff --git a/test_regress/t/t_vpi_get.cpp b/test_regress/t/t_vpi_get.cpp index 0d1a4407a..e862d321d 100644 --- a/test_regress/t/t_vpi_get.cpp +++ b/test_regress/t/t_vpi_get.cpp @@ -88,7 +88,7 @@ unsigned int main_time = false; static int _mon_check_props(TestVpiHandle& handle, int size, int direction, int scalar, int type) { s_vpi_value value = { - vpiIntVal + vpiIntVal, .value = {.integer = 0} }; // check size of object int vpisize = vpi_get(vpiSize, handle); diff --git a/test_regress/t/t_vpi_memory.cpp b/test_regress/t/t_vpi_memory.cpp index ab58de157..07b91844a 100644 --- a/test_regress/t/t_vpi_memory.cpp +++ b/test_regress/t/t_vpi_memory.cpp @@ -89,7 +89,7 @@ unsigned int main_time = false; int _mon_check_range(TestVpiHandle& handle, int size, int left, int right) { TestVpiHandle iter_h, left_h, right_h; s_vpi_value value = { - vpiIntVal + vpiIntVal, .value = {.integer = 0} }; // check size of object int vpisize = vpi_get(vpiSize, handle); @@ -120,7 +120,7 @@ int _mon_check_memory() { TestVpiHandle mem_h, lcl_h; vpiHandle iter_h; // icarus does not like auto free of iterator handles s_vpi_value value = { - vpiIntVal + vpiIntVal, .value = {.integer = 0} }; vpi_printf((PLI_BYTE8*)"Check memory vpi ...\n"); mem_h = vpi_handle_by_name((PLI_BYTE8*)TestSimulator::rooted("mem0"), NULL); diff --git a/test_regress/t/t_vpi_var.cpp b/test_regress/t/t_vpi_var.cpp index f55055f38..c2fdfe065 100644 --- a/test_regress/t/t_vpi_var.cpp +++ b/test_regress/t/t_vpi_var.cpp @@ -395,7 +395,7 @@ int _mon_check_string() { CHECK_RESULT_NZ(vh1); s_vpi_value v; - s_vpi_time t = { vpiSimTime, 0, 0}; + s_vpi_time t = { vpiSimTime, 0, 0, 0.0}; s_vpi_error_info e; v.format = vpiStringVal; diff --git a/test_sc/sc_main.cpp b/test_sc/sc_main.cpp index a8ff1646e..41b9475b7 100644 --- a/test_sc/sc_main.cpp +++ b/test_sc/sc_main.cpp @@ -17,8 +17,6 @@ #include "Vtop.h" // Top level header, generated from verilog -Vtop *top; - int sc_main(int argc, char* argv[]) { Verilated::commandArgs(argc, argv); Verilated::randReset(2);