Internals: Fix cppcheck warnings. No functional change.

This commit is contained in:
Wilson Snyder 2023-03-18 19:28:48 -04:00
parent 2b21697b86
commit 9b869edd90
9 changed files with 8 additions and 11 deletions

View File

@ -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); } 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 VL_NTOI_Q(int obits, const std::string& str) VL_PURE {
QData out = 0; QData out = 0;
const size_t procLen = std::min(str.length(), static_cast<size_t>(8));
const char* const datap = str.data(); const char* const datap = str.data();
int pos = static_cast<int>(str.length()) - 1; int pos = static_cast<int>(str.length()) - 1;
int bit = 0; int bit = 0;

View File

@ -607,6 +607,7 @@ public: // But for internal use only
VerilatedEvalMsgQueue* __Vm_evalMsgQp; VerilatedEvalMsgQueue* __Vm_evalMsgQp;
explicit VerilatedSyms(VerilatedContext* contextp); // Pass null for default context explicit VerilatedSyms(VerilatedContext* contextp); // Pass null for default context
~VerilatedSyms(); ~VerilatedSyms();
VL_UNCOPYABLE(VerilatedSyms);
}; };
//=========================================================================== //===========================================================================

View File

@ -791,7 +791,6 @@ void VerilatedVpiImp::dumpCbs() VL_MT_UNSAFE_ONE {
} }
for (auto& ifuture : s().m_nextCbs) { for (auto& ifuture : s().m_nextCbs) {
const QData time = ifuture.first.first; const QData time = ifuture.first.first;
const uint64_t id = ifuture.first.second;
VerilatedVpiCbHolder& ho = ifuture.second; VerilatedVpiCbHolder& ho = ifuture.second;
if (VL_UNLIKELY(!ho.invalid())) { if (VL_UNLIKELY(!ho.invalid())) {
VL_DBG_MSGF("- vpi: time=%" PRId64 "(NEXT) reason=%d=%s id=%" PRId64 "\n", time, 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) { for (auto& ifuture : s().m_futureCbs) {
const QData time = ifuture.first.first; const QData time = ifuture.first.first;
const uint64_t id = ifuture.first.second;
VerilatedVpiCbHolder& ho = ifuture.second; VerilatedVpiCbHolder& ho = ifuture.second;
if (VL_UNLIKELY(!ho.invalid())) { if (VL_UNLIKELY(!ho.invalid())) {
VL_DBG_MSGF("- vpi: time=%" PRId64 " reason=%d=%s id=%" PRId64 "\n", time, VL_DBG_MSGF("- vpi: time=%" PRId64 " reason=%d=%s id=%" PRId64 "\n", time,

View File

@ -863,8 +863,8 @@ public:
: ASTGEN_SUPER_ClockingItem(fl) { : ASTGEN_SUPER_ClockingItem(fl) {
m_direction = direction; m_direction = direction;
this->skewp(skewp); this->skewp(skewp);
if (AstAssign* const assignp = VN_CAST(clockingDeclp, Assign)) { if (AstAssign* const clkAssignp = VN_CAST(clockingDeclp, Assign)) {
this->assignp(assignp); this->assignp(clkAssignp);
} else { } else {
exprp(VN_AS(clockingDeclp, NodeExpr)); exprp(VN_AS(clockingDeclp, NodeExpr));
} }

View File

@ -201,7 +201,7 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
CCtorsVisitor(AstNode* nodep) { iterate(nodep); } explicit CCtorsVisitor(AstNode* nodep) { iterate(nodep); }
~CCtorsVisitor() override = default; ~CCtorsVisitor() override = default;
}; };

View File

@ -64,5 +64,5 @@ public:
void V3EmitC::emitcInlines() { void V3EmitC::emitcInlines() {
UINFO(2, __FUNCTION__ << ": " << endl); UINFO(2, __FUNCTION__ << ": " << endl);
{ EmitCInlines visitor{v3Global.rootp()}; } { EmitCInlines{v3Global.rootp()}; }
} }

View File

@ -259,8 +259,7 @@ public:
// backwards compatibility inheritance-like warnings // backwards compatibility inheritance-like warnings
if (m_e == other) { return true; } if (m_e == other) { return true; }
if (other == V3ErrorCode::WIDTH) { if (other == V3ErrorCode::WIDTH) {
return (m_e == WIDTH || m_e == WIDTHEXPAND || m_e == WIDTHTRUNC return (m_e == WIDTHEXPAND || m_e == WIDTHTRUNC || m_e == WIDTHXZEXPAND);
|| m_e == WIDTHXZEXPAND);
} }
if (other == V3ErrorCode::I_UNUSED) { if (other == V3ErrorCode::I_UNUSED) {
return (m_e == UNUSEDGENVAR || m_e == UNUSEDPARAM || m_e == UNUSEDSIGNAL); return (m_e == UNUSEDGENVAR || m_e == UNUSEDPARAM || m_e == UNUSEDSIGNAL);

View File

@ -43,7 +43,7 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VlcSourceCount(int lineno) explicit VlcSourceCount(int lineno)
: m_lineno{lineno} {} : m_lineno{lineno} {}
~VlcSourceCount() = default; ~VlcSourceCount() = default;

View File

@ -288,7 +288,7 @@ void VlcTop::annotateOutputFiles(const string& dirname) {
const auto lit = lines.find(lineno); const auto lit = lines.find(lineno);
if (lit == lines.end()) { if (lit == lines.end()) {
os << " " << line << '\n'; os << " " << line << '\n';
} else if (lit != lines.end()) { } else {
VlcSourceCount& sc = lit->second; VlcSourceCount& sc = lit->second;
// UINFO(0,"Source // UINFO(0,"Source
// "<<source.name()<<":"<<sc.lineno()<<":"<<sc.column()<<endl); // "<<source.name()<<":"<<sc.lineno()<<":"<<sc.column()<<endl);