From f10b2919d79685e3b0e08e0eee012b21b1b5dc7e Mon Sep 17 00:00:00 2001 From: Stefan Wallentowitz Date: Sun, 21 Jun 2020 08:14:46 +0200 Subject: [PATCH] Add WIDTHEXACT rule There are many cases where users perceive WIDTH warnings too pedantic and the sheer amount often leads to users using -Wno-WIDTH, thereby hiding those that are more critical. This adds a new rule WIDTHEXACT that is a style lint and thus not enabled by default. It will contain WIDTH warnings that are strict in expecting equal sizes, which is okay with the LRM, but can be a mistake. WIDTH will probably contain mostly warnings that are even not good with the LRM semantics (too large assignment, mismatch in comparison, etc.) --- src/V3Error.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/V3Error.h b/src/V3Error.h index 88f96d0e1..1f60d2d83 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -122,6 +122,7 @@ public: VARHIDDEN, // Hiding variable WIDTH, // Width mismatch WIDTHCONCAT, // Unsized numbers/parameters in concatenations + WIDTHEXACT, // Expect exact widths _ENUM_MAX // ***Add new elements below also*** }; @@ -165,7 +166,7 @@ public: "UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNOPTTHREADS", "UNPACKED", "UNSIGNED", "UNUSED", "USERERROR", "USERFATAL", "USERINFO", "USERWARN", - "VARHIDDEN", "WIDTH", "WIDTHCONCAT", + "VARHIDDEN", "WIDTH", "WIDTHCONCAT", "WIDTHEXACT", " MAX" }; // clang-format on @@ -200,7 +201,8 @@ public: return (m_e == ASSIGNDLY // More than style, but for backward compatibility || m_e == BLKSEQ || m_e == DEFPARAM || m_e == DECLFILENAME || m_e == IMPORTSTAR || m_e == INCABSPATH || m_e == PINCONNECTEMPTY || m_e == PINNOCONNECT - || m_e == SYNCASYNCNET || m_e == UNDRIVEN || m_e == UNUSED || m_e == VARHIDDEN); + || m_e == SYNCASYNCNET || m_e == UNDRIVEN || m_e == UNUSED || m_e == VARHIDDEN + || m_e == WIDTHEXACT); } }; inline bool operator==(const V3ErrorCode& lhs, const V3ErrorCode& rhs) {