diff --git a/include/verilated_random.cpp b/include/verilated_random.cpp index 7e048e6c1..30e45d64d 100644 --- a/include/verilated_random.cpp +++ b/include/verilated_random.cpp @@ -481,13 +481,14 @@ bool VlRandomizer::parseSolution(std::iostream& f) { } const std::string indexed_name = oss.str(); - const auto it = std::find_if(m_arr_vars.begin(), m_arr_vars.end(), - [&indexed_name](const auto& entry) { - return entry.second->m_name == indexed_name; - }); - if (it != m_arr_vars.end()) { + const auto iti = std::find_if(m_arr_vars.begin(), m_arr_vars.end(), + [&indexed_name](const auto& entry) { + return entry.second->m_name == indexed_name; + }); + if (iti != m_arr_vars.end()) { std::ostringstream ss; - ss << "#x" << std::hex << std::setw(8) << std::setfill('0') << it->second->m_index; + ss << "#x" << std::hex << std::setw(8) << std::setfill('0') + << iti->second->m_index; idx = ss.str(); } else { VL_FATAL_MT(__FILE__, __LINE__, "randomize", diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index ac885332d..7654146a1 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -2779,7 +2779,6 @@ vpiHandle vpi_put_value(vpiHandle object, p_vpi_value valuep, p_vpi_time /*time_ } return object; } else if (valuep->format == vpiOctStrVal) { - const int chars = (varBits + 2) / 3; const int len = std::strlen(valuep->value.str); for (int i = 0; i < len; ++i) { char digit = valuep->value.str[len - i - 1] - '0'; @@ -3127,7 +3126,6 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, PLI_INT arrayvalue_p->value.shortints = shortintsp; if (varp->vltype() == VLVT_UINT8) { - const CData* ptr = reinterpret_cast(vop->varDatap()); vl_get_value_array_integrals(index, num, size, varp->entBits(), leftIsLow, vop->varCDatap(), shortintsp); } else if (varp->vltype() == VLVT_UINT16) { @@ -3305,8 +3303,6 @@ void vpi_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, PLI_IN return; } - const VerilatedVar* const varp = vop->varp(); - int lowRange = vop->rangep()->low(); int highRange = vop->rangep()->high(); diff --git a/src/V3AstNodeExpr.h b/src/V3AstNodeExpr.h index f3e418a37..5074373aa 100644 --- a/src/V3AstNodeExpr.h +++ b/src/V3AstNodeExpr.h @@ -1668,7 +1668,7 @@ class AstParseHolder final : public AstNodeExpr { // A reference to something soon to replace, used in a select at parse time // that needs conversion to pull the upper lvalue later public: - AstParseHolder(FileLine* fl) + explicit AstParseHolder(FileLine* fl) : ASTGEN_SUPER_ParseHolder(fl) {} ASTGEN_MEMBERS_AstParseHolder; string emitVerilog() override { V3ERROR_NA_RETURN(""); } @@ -4511,7 +4511,7 @@ public: // === AstNodeTermop === class AstInferredDisable final : public AstNodeTermop { public: - AstInferredDisable(FileLine* fl) + explicit AstInferredDisable(FileLine* fl) : ASTGEN_SUPER_InferredDisable(fl) { dtypeSetLogicSized(1, VSigning::UNSIGNED); } diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index d6b8b67ef..909cfe726 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -640,12 +640,11 @@ class ConstraintExprVisitor final : public VNVisitor { = new AstVarRef{varp->fileline(), classp, varp, VAccess::WRITE}; varRefp->classOrPackagep(classOrPackagep); methodp->addPinsp(varRefp); - size_t width = varp->width(); AstNodeDType* tmpDtypep = varp->dtypep(); while (VN_IS(tmpDtypep, UnpackArrayDType) || VN_IS(tmpDtypep, DynArrayDType) || VN_IS(tmpDtypep, QueueDType) || VN_IS(tmpDtypep, AssocArrayDType)) tmpDtypep = tmpDtypep->subDTypep(); - width = tmpDtypep->width(); + const size_t width = tmpDtypep->width(); methodp->addPinsp( new AstConst{varp->dtypep()->fileline(), AstConst::Unsized64{}, width}); AstNodeExpr* const varnamep