From 621cd0f008ef6bbebc092e8306b2ba5d96455837 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 8 Mar 2023 21:32:37 -0500 Subject: [PATCH] Internals: Framework for renaming warnings (#4010 partial) --- src/V3Error.cpp | 1 + src/V3Error.h | 6 ++++++ 2 files changed, 7 insertions(+) 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; }