Fix MULTIDRIVEN/PROC warning suppression via lint_off (#8000)

This commit is contained in:
Gilberto Abram 2026-07-28 21:50:19 -04:00 committed by GitHub
parent 2e4dbb846c
commit cac2c3df13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 13 deletions

View File

@ -1542,14 +1542,14 @@ string AstNode::instanceStr() const {
return "";
}
void AstNode::v3errorEnd(const std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex) {
// Don't look for instance name when warning is disabled.
// In case of large number of warnings, this can
// take significant amount of time
const string instanceStrExtra
= m_fileline->warnIsOff(V3Error::s().errorCode()) ? "" : instanceStr();
if (!m_fileline) {
V3Error::v3errorEnd(str, instanceStrExtra, nullptr);
V3Error::v3errorEnd(str, "", nullptr);
} else {
// Don't look for instance name when warning is disabled.
// In case of large number of warnings, this can
// take significant amount of time
const string instanceStrExtra
= m_fileline->warnIsOff(V3Error::s().errorCode()) ? "" : instanceStr();
std::ostringstream nsstr;
nsstr << str.str();
if (debug()) {

View File

@ -541,15 +541,20 @@ class UndrivenVisitor final : public VNVisitorConst {
: entryp->callNodep();
const bool sameFileLine
= otherVarRefp && nodep->fileline() == otherVarRefp->fileline();
if (entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef)
&& !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) && !sameFileLine
&& !entryp->isUnderGen() && otherWritep && !entryp->isFtaskDriven()
&& !ftaskDef && !m_inSelLhs
&& (!nodep->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVEN)
|| !nodep->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVENPROC))) {
// Preconditions shared by MULTIDRIVEN and MULTIDRIVENPROC.
const bool multidrivenCommon
= entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef)
&& !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) && !sameFileLine
&& !entryp->isUnderGen() && otherWritep && !entryp->isFtaskDriven()
&& !ftaskDef && !m_inSelLhs;
// The two warnings are gated independently on the variable
// declaration's fileline, as v3warn suppression will check
// the driving fileline and still warn even if the warning
// was suppressed with lint_off at the declaration.
if (multidrivenCommon
&& !nodep->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVEN)) {
const bool otherWriteIsStaticInit
= nodep->varp()->hasUserInit() && otherWritep == entryp->initStaticp();
if (m_alwaysCombp
&& (!entryp->isDrivenAlwaysCombWhole()
|| (m_alwaysCombp != entryp->getAlwCombp()
@ -597,6 +602,9 @@ class UndrivenVisitor final : public VNVisitorConst {
<< "... Location of always_ff write\n"
<< otherWritep->warnContextSecondary());
}
}
if (multidrivenCommon
&& !nodep->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVENPROC)) {
// Two plain always blocks driving the whole signal: legal
// SystemVerilog, but a driver conflict for synthesis. The
// always_ff/always_comb cases above already cover mixes with