mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Internals: Improve cppcheck flow and fix up issues (#6311)
Added cppcheck-suppressions.txt in the repo root. You can add new patterns in there instead of having to parse the XML output. Also configure to add the -D__GNUC__ preprocessor macro, which makes it understand UASSERT (it understands the 'noreturn' function attribute). Added some case by case specific suppressions and fixed up other code, especially in V3Ast*h and V3Dfg*.h, including code generated by astgen that had some no-ops that irks cppcheck. One thing it does not seem to like is `const` class members with default initializers in the class. It will assume that's always the value, even if overridden in the constructor. We had few so removed them. With that a lot of files in `src/` are now clean or only have a handful of issues. Therefore, I have also deleted cppcheck_filtered, and made it produce human readable output straight to the terminal. Regarding cleaning up the reported nits, I kind of got bored after V3[A-E] so pausing here. Apologies for the merge conflicts. Tested with cppcheck 2.13.0
This commit is contained in:
+3
-3
@@ -102,7 +102,7 @@ private:
|
||||
}
|
||||
AstPropSpec* substitutePropertyCall(AstPropSpec* nodep) {
|
||||
if (AstFuncRef* const funcrefp = VN_CAST(nodep->propp(), FuncRef)) {
|
||||
if (AstProperty* const propp = VN_CAST(funcrefp->taskp(), Property)) {
|
||||
if (const AstProperty* const propp = VN_CAST(funcrefp->taskp(), Property)) {
|
||||
AstPropSpec* propExprp = getPropertyExprp(propp);
|
||||
// Substitute inner property call before copying in order to not doing the same for
|
||||
// each call of outer property call.
|
||||
@@ -183,7 +183,7 @@ private:
|
||||
m_clockingp->addNextHere(varp->unlinkFrBack());
|
||||
varp->user1p(nodep);
|
||||
if (nodep->direction() == VDirection::OUTPUT) {
|
||||
exprp->foreach([](AstNodeVarRef* varrefp) {
|
||||
exprp->foreach([](const AstNodeVarRef* varrefp) {
|
||||
// Prevent confusing BLKANDNBLK warnings on clockvars due to generated assignments
|
||||
varrefp->fileline()->warnOff(V3ErrorCode::BLKANDNBLK, true);
|
||||
});
|
||||
@@ -318,7 +318,7 @@ private:
|
||||
if (nodep->stmtsp()) nodep->addNextHere(nodep->stmtsp()->unlinkFrBackWithNext());
|
||||
FileLine* const flp = nodep->fileline();
|
||||
AstNodeExpr* valuep = V3Const::constifyEdit(nodep->lhsp()->unlinkFrBack());
|
||||
AstConst* const constp = VN_CAST(valuep, Const);
|
||||
const AstConst* const constp = VN_CAST(valuep, Const);
|
||||
if (constp->isZero()) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: ##0 delays");
|
||||
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
|
||||
|
||||
Reference in New Issue
Block a user