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.)
This commit is contained in:
Stefan Wallentowitz 2020-06-21 08:14:46 +02:00
parent 23e4a0f784
commit f10b2919d7

View File

@ -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) {