diff --git a/src/V3Error.cpp b/src/V3Error.cpp index 2f1a01f20..670dd7185 100644 --- a/src/V3Error.cpp +++ b/src/V3Error.cpp @@ -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; } } diff --git a/src/V3Error.h b/src/V3Error.h index 05f865f13..2c02e8eaa 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -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; }