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); }
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<size_t>(8));
const char* const datap = str.data();
int pos = static_cast<int>(str.length()) - 1;
int bit = 0;

View File

@ -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);
};
//===========================================================================

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
// "<<source.name()<<":"<<sc.lineno()<<":"<<sc.column()<<endl);