Internals: Suppress vlSelf unused suppression when known used. No functional change intended.

This commit is contained in:
Wilson Snyder 2025-01-25 12:06:05 -05:00
parent 05c7a3b90b
commit 98e40c847c
1 changed files with 12 additions and 9 deletions

View File

@ -304,15 +304,6 @@ public:
}
puts(" {\n");
if (nodep->isLoose()) {
m_lazyDecls.declared(nodep); // Defined here, so no longer needs declaration
if (!nodep->isStatic()) { // Standard prologue
m_useSelfForThis = true;
puts("(void)vlSelf; // Prevent unused variable warning\n");
if (!VN_IS(m_modp, Class)) puts(symClassAssign());
}
}
// "+" in the debug indicates a print from the model
puts("VL_DEBUG_IF(VL_DBG_MSGF(\"+ ");
for (int i = 0; i < m_modp->level(); ++i) puts(" ");
@ -320,6 +311,18 @@ public:
puts(nodep->isLoose() ? "__" : "::");
puts(nodep->nameProtect() + "\\n\"); );\n");
if (nodep->isLoose()) {
m_lazyDecls.declared(nodep); // Defined here, so no longer needs declaration
if (!nodep->isStatic()) { // Standard prologue
m_useSelfForThis = true;
if (!VN_IS(m_modp, Class)) {
puts(symClassAssign()); // Uses vlSelf
} else {
puts("(void)vlSelf; // Prevent unused variable warning\n");
}
}
}
// Instantiate a process class if it's going to be needed somewhere later
nodep->forall([&](const AstNodeCCall* ccallp) -> bool {
if (ccallp->funcp()->needProcess()