Fix warning lint directive ordering and consistency (#4185) (#5368) (#5610) (#6876).

This commit is contained in:
Wilson Snyder
2025-12-30 20:31:34 -05:00
committed by GitHub
parent e6114b6bbb
commit 4080284e53
19 changed files with 515 additions and 108 deletions
+13 -19
View File
@@ -130,7 +130,7 @@ FileLineSingleton::msgEnSetIdx_t FileLineSingleton::defaultMsgEnIndex() VL_MT_SA
// "-Wall" and the like only adjust the code subset, so use default enablement there
msgEnBitSet.set(MsgEnBitSet::Subset::CODE, code, !code.defaultsOff());
// The control file subset is only adjusted by the control files, everything enabled by
// default
// default. (V3Control also likewise creates with this)
msgEnBitSet.set(MsgEnBitSet::Subset::CTRL, code, true);
}
return addMsgEnBitSet(msgEnBitSet);
@@ -145,12 +145,23 @@ FileLineSingleton::msgEnSetIdx_t FileLineSingleton::msgEnSetBit(msgEnSetIdx_t se
if (msgEn(setIdx).test(subset, subcode) != value) same = false;
});
if (same) return setIdx;
// Make new mask of all delegated codes at once (to avoid extra indicies if looped above this)
// Make new mask of all delegated codes at once (to avoid extra indices if looped above this)
MsgEnBitSet msgEnBitSet{msgEn(setIdx)};
code.forDelegateCodes([&](V3ErrorCode subcode) { msgEnBitSet.set(subset, subcode, value); });
return addMsgEnBitSet(msgEnBitSet);
}
FileLineSingleton::msgEnSetIdx_t FileLineSingleton::msgSetCtrlBitSet(msgEnSetIdx_t setIdx,
const VErrorBitSet& bitset) {
const MsgEnBitSet::Subset subset = MsgEnBitSet::Subset::CTRL;
// See if state matches existing
if (msgEn(setIdx).getAll(subset) == bitset) return setIdx;
// Make new mask of all delegated codes at once (to avoid extra indices if looped above this)
MsgEnBitSet msgEnBitSet{msgEn(setIdx)};
msgEnBitSet.setAll(subset, bitset);
return addMsgEnBitSet(msgEnBitSet);
}
FileLineSingleton::msgEnSetIdx_t FileLineSingleton::msgEnAnd(msgEnSetIdx_t lhsIdx,
msgEnSetIdx_t rhsIdx) {
const MsgEnBitSet& lhs = msgEn(lhsIdx);
@@ -395,26 +406,9 @@ string FileLine::warnOffParse(const string& msgs, bool turnOff) {
return result;
}
void FileLine::warnLintOff(bool turnOff) {
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code{codei};
if (code.lintError()) warnOff(code, turnOff);
}
}
void FileLine::warnStyleOff(bool turnOff) {
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
const V3ErrorCode code{codei};
if (code.styleError()) warnOff(code, turnOff);
}
}
bool FileLine::warnIsOff(V3ErrorCode code) const {
if (!msgEn().enabled(code)) return true;
if (!defaultFileLine().msgEn().enabled(code)) return true; // Global overrides local
if ((code.lintError() || code.styleError()) && !msgEn().enabled(V3ErrorCode::I_LINT)) {
return true;
}
return false;
}