Split UNUSED warning into genvar, param, and signal warnings (#3607)

This commit is contained in:
Topa Topino
2022-10-17 19:51:13 -04:00
committed by GitHub
parent 22ce36012e
commit 46c5764383
18 changed files with 193 additions and 67 deletions
+18 -1
View File
@@ -332,7 +332,15 @@ std::ostream& operator<<(std::ostream& os, FileLine* fileline) {
}
bool FileLine::warnOff(const string& msg, bool flag) {
const V3ErrorCode code(msg.c_str());
const char *cmsg = msg.c_str();
// Backward compatibility with msg="UNUSED"
if (V3ErrorCode::unusedMsg(cmsg)) {
warnOff(V3ErrorCode::UNUSEDGENVAR, flag);
warnOff(V3ErrorCode::UNUSEDPARAM , flag);
warnOff(V3ErrorCode::UNUSEDSIGNAL, flag);
return true;
}
const V3ErrorCode code(cmsg);
if (code < V3ErrorCode::EC_FIRST_WARN) {
return false;
} else {
@@ -355,12 +363,21 @@ void FileLine::warnStyleOff(bool flag) {
}
}
void FileLine::warnUnusedOff(bool flag) {
warnOff(V3ErrorCode::UNUSEDGENVAR, flag);
warnOff(V3ErrorCode::UNUSEDPARAM, flag);
warnOff(V3ErrorCode::UNUSEDSIGNAL, flag);
}
bool FileLine::warnIsOff(V3ErrorCode code) const {
if (!msgEn().test(code)) return true;
if (!defaultFileLine().msgEn().test(code)) return true; // Global overrides local
if ((code.lintError() || code.styleError()) && !msgEn().test(V3ErrorCode::I_LINT)) {
return true;
}
if ((code.unusedError()) && !msgEn().test(V3ErrorCode::I_UNUSED)) {
return true;
}
return false;
}