mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Internals: cppcheck cleanups. No functional change intended.
This commit is contained in:
parent
90009b9ec7
commit
10fc1f757c
@ -137,7 +137,7 @@ class VlDelayScheduler final {
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
VlDelayScheduler(VerilatedContext& context)
|
||||
explicit VlDelayScheduler(VerilatedContext& context)
|
||||
: m_context{context} {}
|
||||
// METHODS
|
||||
// Resume coroutines waiting for the current simulation time
|
||||
@ -329,8 +329,8 @@ public:
|
||||
|
||||
// CONSTRUCTORS
|
||||
// Construct
|
||||
VlCoroutine(VlPromise* p)
|
||||
: m_promisep{p} {
|
||||
VlCoroutine(VlPromise* promisep)
|
||||
: m_promisep{promisep} {
|
||||
m_promisep->m_corop = this;
|
||||
}
|
||||
// Move. Update the pointers each time the return object is moved
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
|
||||
// Set elements of 'this' to 'a & !b' element-wise
|
||||
void andNot(const VlTriggerVec<T_size>& a, const VlTriggerVec<T_size>& b) {
|
||||
for (size_t i = 0; i < m_flags.size(); ++i) m_flags[i] = a.m_flags[i] & !b.m_flags[i];
|
||||
for (size_t i = 0; i < m_flags.size(); ++i) m_flags[i] = a.m_flags[i] && !b.m_flags[i];
|
||||
}
|
||||
};
|
||||
|
||||
@ -1104,14 +1104,17 @@ public:
|
||||
m_objp->m_deleter = &deleter;
|
||||
refCountInc();
|
||||
}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
VlClassRef(T_Class* objp)
|
||||
: m_objp{objp} {
|
||||
refCountInc();
|
||||
}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
VlClassRef(const VlClassRef& copied)
|
||||
: m_objp{copied.m_objp} {
|
||||
refCountInc();
|
||||
}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
VlClassRef(VlClassRef&& moved)
|
||||
: m_objp{vlstd::exchange(moved.m_objp, nullptr)} {}
|
||||
~VlClassRef() { refCountDec(); }
|
||||
|
@ -2324,7 +2324,7 @@ template <typename T_Arg, bool Default>
|
||||
bool AstNode::predicateImpl(ConstCorrectAstNode<T_Arg>* nodep,
|
||||
const std::function<bool(T_Arg*)>& p) {
|
||||
// Implementation similar to foreach, but abort traversal as soon as result is determined.
|
||||
if (!p) {
|
||||
if (VL_UNCOVERABLE(!p)) {
|
||||
nodep->v3fatal("AstNode::foreach called with unbound function"); // LCOV_EXCL_LINE
|
||||
} else {
|
||||
using T_Arg_NonConst = typename std::remove_const<T_Arg>::type;
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
m_widthMin = widthMin;
|
||||
}
|
||||
// For backward compatibility inherit width and signing from the subDType/base type
|
||||
void widthFromSub(AstNodeDType* nodep) {
|
||||
void widthFromSub(const AstNodeDType* nodep) {
|
||||
m_width = nodep->m_width;
|
||||
m_widthMin = nodep->m_widthMin;
|
||||
m_numeric = nodep->m_numeric;
|
||||
|
@ -89,21 +89,21 @@ AstShiftRS* makeNode<AstShiftRS, AstNodeMath*, AstNodeMath*>( //
|
||||
// LCOV_EXCL_START
|
||||
template <>
|
||||
AstCCast* makeNode<AstCCast, AstNodeMath*>(const DfgCCast* vtxp, AstNodeMath*) {
|
||||
vtxp->v3fatal("not implemented");
|
||||
vtxp->v3fatalSrc("not implemented");
|
||||
}
|
||||
template <>
|
||||
AstAtoN* makeNode<AstAtoN, AstNodeMath*>(const DfgAtoN* vtxp, AstNodeMath*) {
|
||||
vtxp->v3fatal("not implemented");
|
||||
vtxp->v3fatalSrc("not implemented");
|
||||
}
|
||||
template <>
|
||||
AstCompareNN* makeNode<AstCompareNN, AstNodeMath*, AstNodeMath*>(const DfgCompareNN* vtxp,
|
||||
AstNodeMath*, AstNodeMath*) {
|
||||
vtxp->v3fatal("not implemented");
|
||||
vtxp->v3fatalSrc("not implemented");
|
||||
}
|
||||
template <>
|
||||
AstSliceSel* makeNode<AstSliceSel, AstNodeMath*, AstNodeMath*, AstNodeMath*>(
|
||||
const DfgSliceSel* vtxp, AstNodeMath*, AstNodeMath*, AstNodeMath*) {
|
||||
vtxp->v3fatal("not implemented");
|
||||
vtxp->v3fatalSrc("not implemented");
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
|
@ -33,7 +33,7 @@ class V3DfgCseContext final {
|
||||
|
||||
public:
|
||||
VDouble0 m_eliminated; // Number of common sub-expressions eliminated
|
||||
V3DfgCseContext(const std::string& label)
|
||||
explicit V3DfgCseContext(const std::string& label)
|
||||
: m_label{label} {}
|
||||
~V3DfgCseContext();
|
||||
};
|
||||
@ -43,7 +43,7 @@ class DfgRemoveVarsContext final {
|
||||
|
||||
public:
|
||||
VDouble0 m_removed; // Number of redundant variables removed
|
||||
DfgRemoveVarsContext(const std::string& label)
|
||||
explicit DfgRemoveVarsContext(const std::string& label)
|
||||
: m_label{label} {}
|
||||
~DfgRemoveVarsContext();
|
||||
};
|
||||
@ -73,7 +73,7 @@ public:
|
||||
V3DfgCseContext m_cseContext1{m_label + " 2nd"};
|
||||
V3DfgPeepholeContext m_peepholeContext{m_label};
|
||||
DfgRemoveVarsContext m_removeVarsContext{m_label};
|
||||
V3DfgOptimizationContext(const std::string& label);
|
||||
explicit V3DfgOptimizationContext(const std::string& label);
|
||||
~V3DfgOptimizationContext();
|
||||
|
||||
const std::string& prefix() const { return m_prefix; }
|
||||
|
@ -132,7 +132,7 @@ struct V3DfgPeepholeContext final {
|
||||
// Count of applications for each optimization (for statistics)
|
||||
VDouble0 m_count[VDfgPeepholePattern::_ENUM_END];
|
||||
|
||||
V3DfgPeepholeContext(const std::string& label);
|
||||
explicit V3DfgPeepholeContext(const std::string& label);
|
||||
~V3DfgPeepholeContext();
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ constexpr int MAX_SPRINTF_DOUBLE_SIZE
|
||||
//======================================================================
|
||||
// Errors
|
||||
|
||||
void V3Number::v3errorEnd(std::ostringstream& str) const {
|
||||
void V3Number::v3errorEnd(const std::ostringstream& str) const {
|
||||
std::ostringstream nsstr;
|
||||
nsstr << str.str();
|
||||
if (m_nodep) {
|
||||
@ -88,7 +88,7 @@ void V3Number::v3errorEnd(std::ostringstream& str) const {
|
||||
}
|
||||
}
|
||||
|
||||
void V3Number::v3errorEndFatal(std::ostringstream& str) const {
|
||||
void V3Number::v3errorEndFatal(const std::ostringstream& str) const {
|
||||
v3errorEnd(str);
|
||||
assert(0); // LCOV_EXCL_LINE
|
||||
VL_UNREACHABLE;
|
||||
|
@ -541,8 +541,8 @@ private:
|
||||
string displayed(const string& vformat) const { return displayed(m_fileline, vformat); }
|
||||
|
||||
public:
|
||||
void v3errorEnd(std::ostringstream& sstr) const;
|
||||
void v3errorEndFatal(std::ostringstream& sstr) const VL_ATTR_NORETURN;
|
||||
void v3errorEnd(const std::ostringstream& sstr) const;
|
||||
void v3errorEndFatal(const std::ostringstream& sstr) const VL_ATTR_NORETURN;
|
||||
void width(int width, bool sized = true) {
|
||||
m_data.m_sized = sized;
|
||||
m_data.resize(width);
|
||||
|
@ -208,7 +208,7 @@ class OrderBuildVisitor final : public VNVisitor {
|
||||
"AstSenTrees should have been made global in V3ActiveTop");
|
||||
UASSERT_OBJ(m_scopep, nodep, "AstActive not under AstScope");
|
||||
UASSERT_OBJ(!m_logicVxp, nodep, "AstActive under logic");
|
||||
UASSERT_OBJ(!m_inClocked && !m_domainp & !m_hybridp, nodep, "Should not nest");
|
||||
UASSERT_OBJ(!m_inClocked && !m_domainp && !m_hybridp, nodep, "Should not nest");
|
||||
|
||||
// This is the original sensitivity of the block (i.e.: not the ref into the TRIGGERVEC)
|
||||
|
||||
|
@ -915,9 +915,9 @@ class ParamVisitor final : public VNVisitor {
|
||||
// Process interface cells, then non-interface cells, which may reference an interface
|
||||
// cell.
|
||||
while (!m_cellps.empty()) {
|
||||
const auto itm = m_cellps.cbegin();
|
||||
AstNode* const cellp = itm->second;
|
||||
m_cellps.erase(itm);
|
||||
const auto itim = m_cellps.cbegin();
|
||||
AstNode* const cellp = itim->second;
|
||||
m_cellps.erase(itim);
|
||||
|
||||
AstNodeModule* srcModp = nullptr;
|
||||
if (const auto* modCellp = VN_CAST(cellp, Cell)) {
|
||||
|
@ -928,7 +928,7 @@ class PartPropagateCp final {
|
||||
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
PartPropagateCp(bool slowAsserts)
|
||||
explicit PartPropagateCp(bool slowAsserts)
|
||||
: m_slowAsserts{slowAsserts} {}
|
||||
|
||||
// METHODS
|
||||
|
@ -97,7 +97,7 @@ AstAssign* setVar(AstVarScope* vscp, uint32_t val) {
|
||||
return new AstAssign{flp, refp, valp};
|
||||
};
|
||||
|
||||
void remapSensitivities(LogicByScope& lbs,
|
||||
void remapSensitivities(const LogicByScope& lbs,
|
||||
std::unordered_map<const AstSenTree*, AstSenTree*> senTreeMap) {
|
||||
for (const auto& pair : lbs) {
|
||||
AstActive* const activep = pair.second;
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
AstScope* m_scopep = nullptr; // Current scope
|
||||
AstActive* m_activep = nullptr; // Current active
|
||||
AstNode* m_procp = nullptr; // NodeProcedure/CFunc/Fork we're under
|
||||
double m_timescaleFactor; // Factor to scale delays by
|
||||
double m_timescaleFactor = 1.0; // Factor to scale delays by
|
||||
|
||||
// Unique names
|
||||
V3UniqueNames m_contAssignVarNames{"__VassignWtmp__"}; // Names for temp AssignW vars
|
||||
|
@ -4363,7 +4363,7 @@ private:
|
||||
fmt = ch;
|
||||
} else if (inPct && (isdigit(ch) || ch == '.' || ch == '-')) {
|
||||
fmt += ch;
|
||||
} else if (tolower(inPct)) {
|
||||
} else if (inPct) {
|
||||
inPct = false;
|
||||
bool added = false;
|
||||
switch (tolower(ch)) {
|
||||
|
Loading…
Reference in New Issue
Block a user