Parser: Move 'static' unsupported messages down out of parser.

This commit is contained in:
Wilson Snyder 2020-07-02 21:02:49 -04:00
parent 50c28fa9d3
commit ee7b399bf5
5 changed files with 28 additions and 22 deletions

View File

@ -117,6 +117,9 @@ public:
inline bool operator==(const VLifetime& lhs, const VLifetime& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const VLifetime& lhs, VLifetime::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VLifetime::en lhs, const VLifetime& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const VLifetime& rhs) {
return os << rhs.ascii();
}
//######################################################################

View File

@ -1012,7 +1012,9 @@ class LinkDotFindVisitor : public AstNVisitor {
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
return;
}
if (nodep->isClassMember() && nodep->lifetime().isStatic()) {
if (nodep->isFuncLocal() && nodep->lifetime().isStatic()) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: 'static' function/task variables");
} else if (nodep->isClassMember() && nodep->lifetime().isStatic()) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: 'static' class members");
}
if (!m_statep->forScopeCreation()) {

View File

@ -111,7 +111,13 @@ private:
if (m_classp && nodep->isParam())
nodep->v3warn(E_UNSUPPORTED, "Unsupported: class parameter");
if (m_ftaskp) nodep->funcLocal(true);
if (nodep->lifetime().isNone()) nodep->lifetime(m_lifetime);
if (nodep->lifetime().isNone()) {
if (nodep->isFuncLocal() && nodep->isIO()) {
nodep->lifetime(VLifetime::AUTOMATIC);
} else {
nodep->lifetime(m_lifetime);
}
}
if (nodep->isSigModPublic()) {
nodep->sigModPublic(false); // We're done with this attribute
m_modp->modPublic(true); // Avoid flattening if signals are exposed
@ -130,7 +136,7 @@ private:
if (m_classp) nodep->classMethod(true);
VLifetime origLifetime = m_lifetime;
{
if (!nodep->lifetime().isNone()) m_lifetime = nodep->lifetime();
m_lifetime = nodep->lifetime();
if (m_lifetime.isNone()) m_lifetime = VLifetime::AUTOMATIC;
m_ftaskp = nodep;
iterateChildren(nodep);

View File

@ -3779,7 +3779,7 @@ lifetimeE<lifetime>: // IEEE: [lifetime]
lifetime<lifetime>: // ==IEEE: lifetime
// // Note lifetime used by members is instead under memberQual
ySTATIC__ETC { $$ = VLifetime::STATIC; BBUNSUP($1, "Unsupported: Static in this context"); }
ySTATIC__ETC { $$ = VLifetime::STATIC; }
| yAUTOMATIC { $$ = VLifetime::AUTOMATIC; }
;

View File

@ -1,22 +1,17 @@
%Error-UNSUPPORTED: t/t_var_static.v:20:7: Unsupported: Static in this context
%Error-UNSUPPORTED: t/t_var_static.v:20:18: Unsupported: 'static' function/task variables
: ... In instance t
20 | static int st = 2; st++; return st;
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:26:13: Unsupported: Static in this context
26 | function static int f_st_no ();
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:29:13: Unsupported: Static in this context
29 | function static int f_st_st ();
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:30:7: Unsupported: Static in this context
| ^~
%Error-UNSUPPORTED: t/t_var_static.v:27:11: Unsupported: 'static' function/task variables
: ... In instance t
27 | int st = 2; st++; return st;
| ^~
%Error-UNSUPPORTED: t/t_var_static.v:30:18: Unsupported: 'static' function/task variables
: ... In instance t
30 | static int st = 2; st++; return st;
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:32:13: Unsupported: Static in this context
32 | function static int f_st_au ();
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:40:7: Unsupported: Static in this context
| ^~
%Error-UNSUPPORTED: t/t_var_static.v:40:18: Unsupported: 'static' function/task variables
: ... In instance t
40 | static int st = 2; st++; return st;
| ^~~~~~
%Error-UNSUPPORTED: t/t_var_static.v:73:7: Unsupported: Static in this context
73 | static int ist2;
| ^~~~~~
| ^~
%Error: Exiting due to