Internals: cppcheck fixes. No functional change intended

This commit is contained in:
Wilson Snyder 2023-04-08 21:36:32 -04:00
parent 114d93b212
commit 7ae0c5d546
4 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -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;