From 9b869edd903f02199fa91644ab9db61a262c12ce Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 18 Mar 2023 19:28:48 -0400 Subject: [PATCH] Internals: Fix cppcheck warnings. No functional change. --- include/verilated.cpp | 1 - include/verilated.h | 1 + include/verilated_vpi.cpp | 2 -- src/V3AstNodeOther.h | 4 ++-- src/V3CCtors.cpp | 2 +- src/V3EmitCInlines.cpp | 2 +- src/V3Error.h | 3 +-- src/VlcSource.h | 2 +- src/VlcTop.cpp | 2 +- 9 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/verilated.cpp b/include/verilated.cpp index 995656840..bcc4f65e8 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -1871,7 +1871,6 @@ IData VL_ATOI_N(const std::string& str, int base) VL_PURE { IData VL_NTOI_I(int obits, const std::string& str) VL_PURE { return VL_NTOI_Q(obits, str); } QData VL_NTOI_Q(int obits, const std::string& str) VL_PURE { QData out = 0; - const size_t procLen = std::min(str.length(), static_cast(8)); const char* const datap = str.data(); int pos = static_cast(str.length()) - 1; int bit = 0; diff --git a/include/verilated.h b/include/verilated.h index 822fc89fa..70c12f362 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -607,6 +607,7 @@ public: // But for internal use only VerilatedEvalMsgQueue* __Vm_evalMsgQp; explicit VerilatedSyms(VerilatedContext* contextp); // Pass null for default context ~VerilatedSyms(); + VL_UNCOPYABLE(VerilatedSyms); }; //=========================================================================== diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index 4c255ed79..4d84eca49 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -791,7 +791,6 @@ void VerilatedVpiImp::dumpCbs() VL_MT_UNSAFE_ONE { } for (auto& ifuture : s().m_nextCbs) { const QData time = ifuture.first.first; - const uint64_t id = ifuture.first.second; VerilatedVpiCbHolder& ho = ifuture.second; if (VL_UNLIKELY(!ho.invalid())) { VL_DBG_MSGF("- vpi: time=%" PRId64 "(NEXT) reason=%d=%s id=%" PRId64 "\n", time, @@ -802,7 +801,6 @@ void VerilatedVpiImp::dumpCbs() VL_MT_UNSAFE_ONE { } for (auto& ifuture : s().m_futureCbs) { const QData time = ifuture.first.first; - const uint64_t id = ifuture.first.second; VerilatedVpiCbHolder& ho = ifuture.second; if (VL_UNLIKELY(!ho.invalid())) { VL_DBG_MSGF("- vpi: time=%" PRId64 " reason=%d=%s id=%" PRId64 "\n", time, diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index ed0bf5098..a37d2abe7 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -863,8 +863,8 @@ public: : ASTGEN_SUPER_ClockingItem(fl) { m_direction = direction; this->skewp(skewp); - if (AstAssign* const assignp = VN_CAST(clockingDeclp, Assign)) { - this->assignp(assignp); + if (AstAssign* const clkAssignp = VN_CAST(clockingDeclp, Assign)) { + this->assignp(clkAssignp); } else { exprp(VN_AS(clockingDeclp, NodeExpr)); } diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index 216f8141e..bfe88f481 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -201,7 +201,7 @@ private: public: // CONSTRUCTORS - CCtorsVisitor(AstNode* nodep) { iterate(nodep); } + explicit CCtorsVisitor(AstNode* nodep) { iterate(nodep); } ~CCtorsVisitor() override = default; }; diff --git a/src/V3EmitCInlines.cpp b/src/V3EmitCInlines.cpp index 86da5ff14..e2603371e 100644 --- a/src/V3EmitCInlines.cpp +++ b/src/V3EmitCInlines.cpp @@ -64,5 +64,5 @@ public: void V3EmitC::emitcInlines() { UINFO(2, __FUNCTION__ << ": " << endl); - { EmitCInlines visitor{v3Global.rootp()}; } + { EmitCInlines{v3Global.rootp()}; } } diff --git a/src/V3Error.h b/src/V3Error.h index 4d7f3b1de..43ab1b696 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -259,8 +259,7 @@ public: // backwards compatibility inheritance-like warnings if (m_e == other) { return true; } if (other == V3ErrorCode::WIDTH) { - return (m_e == WIDTH || m_e == WIDTHEXPAND || m_e == WIDTHTRUNC - || m_e == WIDTHXZEXPAND); + return (m_e == WIDTHEXPAND || m_e == WIDTHTRUNC || m_e == WIDTHXZEXPAND); } if (other == V3ErrorCode::I_UNUSED) { return (m_e == UNUSEDGENVAR || m_e == UNUSEDPARAM || m_e == UNUSEDSIGNAL); diff --git a/src/VlcSource.h b/src/VlcSource.h index f08188e1e..788945787 100644 --- a/src/VlcSource.h +++ b/src/VlcSource.h @@ -43,7 +43,7 @@ private: public: // CONSTRUCTORS - VlcSourceCount(int lineno) + explicit VlcSourceCount(int lineno) : m_lineno{lineno} {} ~VlcSourceCount() = default; diff --git a/src/VlcTop.cpp b/src/VlcTop.cpp index 728813622..db60851b0 100644 --- a/src/VlcTop.cpp +++ b/src/VlcTop.cpp @@ -288,7 +288,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) { const auto lit = lines.find(lineno); if (lit == lines.end()) { os << " " << line << '\n'; - } else if (lit != lines.end()) { + } else { VlcSourceCount& sc = lit->second; // UINFO(0,"Source // "<