Internals: Framework for renaming warnings (#4010 partial)

This commit is contained in:
Wilson Snyder 2023-03-08 21:32:37 -05:00
parent 13c9877099
commit 621cd0f008
2 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
const V3ErrorCode code{codei};
if (0 == VL_STRCASECMP(msgp, code.ascii())) {
m_e = code;
if (isRenamed()) m_e = renamedTo().m_e;
return;
}
}

View File

@ -248,6 +248,12 @@ public:
return (m_e == UNUSEDGENVAR || m_e == UNUSEDPARAM || m_e == UNUSEDSIGNAL);
}
V3ErrorCode renamedTo() const {
// Return a new error this error has been renamed to
// e.g. if (m_e == LITENDIAN) return V3ErrorCode{RANGEASC};
return V3ErrorCode{EC_MIN}; // Not renamed; see isRenamed()
}
bool isRenamed() const { return renamedTo() != V3ErrorCode{EC_MIN}; }
bool isUnder(V3ErrorCode other) {
// backwards compatibility inheritance-like warnings
if (m_e == other) { return true; }