forked from github/verilator
Fix ENUMVALUE error to show value location (#3783)
This commit is contained in:
parent
c303ba7f0a
commit
054b792021
@ -6149,14 +6149,15 @@ private:
|
||||
= VN_CAST(expDTypep->skipRefToEnump(), EnumDType)) {
|
||||
const auto castable = computeCastable(expEnump, underp->dtypep(), underp);
|
||||
if (castable != COMPATIBLE && castable != ENUM_IMPLICIT && !VN_IS(underp, Cast)
|
||||
&& !VN_IS(underp, CastDynamic) && !m_enumItemp && warnOn) {
|
||||
nodep->v3warn(ENUMVALUE,
|
||||
"Implicit conversion to enum "
|
||||
<< expDTypep->prettyDTypeNameQ() << " from "
|
||||
<< underp->dtypep()->prettyDTypeNameQ()
|
||||
<< " (IEEE 1800-2017 6.19.3)\n"
|
||||
<< nodep->warnMore()
|
||||
<< "... Suggest use enum's mnemonic, or static cast");
|
||||
&& !VN_IS(underp, CastDynamic) && !m_enumItemp
|
||||
&& !nodep->fileline()->warnIsOff(V3ErrorCode::ENUMVALUE) && warnOn) {
|
||||
underp->v3warn(ENUMVALUE,
|
||||
"Implicit conversion to enum "
|
||||
<< expDTypep->prettyDTypeNameQ() << " from "
|
||||
<< underp->dtypep()->prettyDTypeNameQ()
|
||||
<< " (IEEE 1800-2017 6.19.3)\n"
|
||||
<< nodep->warnMore()
|
||||
<< "... Suggest use enum's mnemonic, or static cast");
|
||||
if (debug()) nodep->backp()->dumpTree("- back: ");
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:28:9: Implicit conversion to enum 't.e_t' from 'logic[31:0]' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:28:11: Implicit conversion to enum 't.e_t' from 'logic[31:0]' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
: ... Suggest use enum's mnemonic, or static cast
|
||||
28 | e = 1;
|
||||
| ^
|
||||
| ^
|
||||
... For error description see https://verilator.org/warn/ENUMVALUE?v=latest
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:29:9: Implicit conversion to enum 't.o_t' from 't.e_t' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:29:11: Implicit conversion to enum 't.o_t' from 't.e_t' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
: ... Suggest use enum's mnemonic, or static cast
|
||||
29 | o = e;
|
||||
| ^
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:35:9: Implicit conversion to enum 't.o_t' from 'ENUMDTYPE 't.e_t'' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
| ^
|
||||
%Error-ENUMVALUE: t/t_enum_type_bad.v:35:15: Implicit conversion to enum 't.o_t' from 'ENUMDTYPE 't.e_t'' (IEEE 1800-2017 6.19.3)
|
||||
: ... In instance t
|
||||
: ... Suggest use enum's mnemonic, or static cast
|
||||
35 | o = str.m_e;
|
||||
| ^
|
||||
| ^~~
|
||||
%Error: Exiting due to
|
||||
|
Loading…
Reference in New Issue
Block a user