From 7ae0c5d546c403290bab39e025709d680137ddc0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 8 Apr 2023 21:36:32 -0400 Subject: [PATCH] Internals: cppcheck fixes. No functional change intended --- include/verilated_types.h | 2 +- src/V3CCtors.cpp | 1 + src/V3LinkLevel.cpp | 2 +- src/V3Width.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/verilated_types.h b/include/verilated_types.h index 5cc66b1ea..940aeafe9 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -151,7 +151,7 @@ public: // having to check for construction at each call // Alternative: seed with zero and check on rand64() call VlRNG() VL_MT_SAFE; - VlRNG(uint64_t seed0) VL_MT_SAFE : m_state{0x12341234UL, seed0} {} + explicit VlRNG(uint64_t seed0) VL_MT_SAFE : m_state{0x12341234UL, seed0} {} void srandom(uint64_t n) VL_MT_UNSAFE; // Unused: std::string get_randstate() const VL_MT_UNSAFE; // Unused: void set_randstate(const std::string& state) VL_MT_UNSAFE; diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index bfe88f481..a079006ec 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -148,6 +148,7 @@ private: m_modp = nodep; V3CCtorsBuilder var_reset{nodep, "_ctor_var_reset", VN_IS(nodep, Class) ? VCtorType::CLASS : VCtorType::MODULE}; + // cppcheck-suppress danglingLifetime m_varResetp = &var_reset; iterateChildren(nodep); diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index 9718b9b67..11fffed29 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -59,7 +59,7 @@ void V3LinkLevel::modSortByLevel() { if (tops.size() >= 2) { const AstNode* const secp = tops[1]; // Complain about second one, as first often intended if (!secp->fileline()->warnIsOff(V3ErrorCode::MULTITOP)) { - auto warnTopModules = [](std::string warnMore, ModVec tops) + auto warnTopModules = [](const std::string& warnMore, ModVec tops) VL_REQUIRES(V3Error::s().m_mutex) -> std::string { std::stringstream ss; for (AstNode* alsop : tops) { diff --git a/src/V3Width.cpp b/src/V3Width.cpp index bb5e25edb..962af7e9f 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -3798,7 +3798,7 @@ private: } // The AstNodeAssign visitor will be soon be replacing this node, make sure it gets it if (!VN_IS(nodep->backp(), NodeAssign)) { - if (adtypep) UINFO(1, "Got backp " << nodep->backp() << endl); + UINFO(1, "Got backp " << nodep->backp() << endl); nodep->v3error( "dynamic new() not expected in this context (expected under an assign)"); return;