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)) {
|
= VN_CAST(expDTypep->skipRefToEnump(), EnumDType)) {
|
||||||
const auto castable = computeCastable(expEnump, underp->dtypep(), underp);
|
const auto castable = computeCastable(expEnump, underp->dtypep(), underp);
|
||||||
if (castable != COMPATIBLE && castable != ENUM_IMPLICIT && !VN_IS(underp, Cast)
|
if (castable != COMPATIBLE && castable != ENUM_IMPLICIT && !VN_IS(underp, Cast)
|
||||||
&& !VN_IS(underp, CastDynamic) && !m_enumItemp && warnOn) {
|
&& !VN_IS(underp, CastDynamic) && !m_enumItemp
|
||||||
nodep->v3warn(ENUMVALUE,
|
&& !nodep->fileline()->warnIsOff(V3ErrorCode::ENUMVALUE) && warnOn) {
|
||||||
"Implicit conversion to enum "
|
underp->v3warn(ENUMVALUE,
|
||||||
<< expDTypep->prettyDTypeNameQ() << " from "
|
"Implicit conversion to enum "
|
||||||
<< underp->dtypep()->prettyDTypeNameQ()
|
<< expDTypep->prettyDTypeNameQ() << " from "
|
||||||
<< " (IEEE 1800-2017 6.19.3)\n"
|
<< underp->dtypep()->prettyDTypeNameQ()
|
||||||
<< nodep->warnMore()
|
<< " (IEEE 1800-2017 6.19.3)\n"
|
||||||
<< "... Suggest use enum's mnemonic, or static cast");
|
<< nodep->warnMore()
|
||||||
|
<< "... Suggest use enum's mnemonic, or static cast");
|
||||||
if (debug()) nodep->backp()->dumpTree("- back: ");
|
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)
|
%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
|
: ... In instance t
|
||||||
: ... Suggest use enum's mnemonic, or static cast
|
: ... Suggest use enum's mnemonic, or static cast
|
||||||
28 | e = 1;
|
28 | e = 1;
|
||||||
| ^
|
| ^
|
||||||
... For error description see https://verilator.org/warn/ENUMVALUE?v=latest
|
... 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)
|
%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
|
: ... In instance t
|
||||||
: ... Suggest use enum's mnemonic, or static cast
|
: ... Suggest use enum's mnemonic, or static cast
|
||||||
29 | o = e;
|
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)
|
%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
|
: ... In instance t
|
||||||
: ... Suggest use enum's mnemonic, or static cast
|
: ... Suggest use enum's mnemonic, or static cast
|
||||||
35 | o = str.m_e;
|
35 | o = str.m_e;
|
||||||
| ^
|
| ^~~
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
Loading…
Reference in New Issue
Block a user