Internals: Fix remaining cppcheck errors (#6319)

Fixed the non const-related issue and added suppressions for the const
ones. With that `make cppcheck` should be clean.
This commit is contained in:
Geza Lore
2025-08-21 09:43:37 +01:00
committed by GitHub
parent bd91b619ad
commit 327d55d13d
64 changed files with 266 additions and 134 deletions
+5 -1
View File
@@ -357,6 +357,7 @@ private:
public:
// CONSTRUCTORS
// cppcheck-suppress constParameterCallback
LogicMTask(V3Graph* graphp, OrderMoveVertex* mVtxp)
: V3GraphVertex{graphp}
, m_id{s_nextId++} {
@@ -676,6 +677,7 @@ void SiblingMC::unlinkA() {
void SiblingMC::unlinkB() { m_bp->bSiblingMCs().unlink(this); }
// cppcheck-suppress duplInheritedMember
bool SiblingMC::mergeWouldCreateCycle() const {
return (LogicMTask::pathExistsFrom(m_ap, m_bp, nullptr)
|| LogicMTask::pathExistsFrom(m_bp, m_ap, nullptr));
@@ -696,6 +698,7 @@ LogicMTask* MTaskEdge::furtherMTaskp() const {
LogicMTask* MTaskEdge::fromMTaskp() const { return static_cast<LogicMTask*>(fromp()); }
LogicMTask* MTaskEdge::toMTaskp() const { return static_cast<LogicMTask*>(top()); }
// cppcheck-suppress duplInheritedMember
bool MTaskEdge::mergeWouldCreateCycle() const {
return LogicMTask::pathExistsFrom(fromMTaskp(), toMTaskp(), this);
}
@@ -1204,6 +1207,7 @@ public:
mergeCanp->rescore();
const uint64_t actualScore = mergeCanp->score();
// cppcheck-suppress knownConditionTrueFalse // they are in fact different
if (actualScore > cachedScore) {
// Cached score is out-of-date.
// Mark this elem as in need of a rescore and continue.
@@ -1322,7 +1326,7 @@ public:
private:
template <GraphWay::en N_Way>
NewCp newCp(LogicMTask* mtaskp, LogicMTask* otherp, MTaskEdge* mergeEdgep) {
NewCp newCp(const LogicMTask* mtaskp, const LogicMTask* otherp, const MTaskEdge* mergeEdgep) {
constexpr GraphWay way{N_Way};
// Return new wayward-CP for mtaskp reflecting its upcoming merge
// with otherp. Set 'result.propagate' if mtaskp's wayward