From fe80499f9ccb8a6ac0c3bece04956dd9d6f871ac Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 7 Oct 2017 13:18:05 -0400 Subject: [PATCH] Internals: Move preproc DEV expansion when in ifndef, cleanup prep for bug1225. --- src/V3PreProc.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 1297c7a09..744fb6508 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -1278,27 +1278,25 @@ int V3PreProcImp::getStateToken() { else { string params = defParams(name); if (params=="0" || params=="") { // Found, as simple substitution - if (m_off) { - goto next_tok; - } - else { + string out; + if (!m_off) { V3DefineRef tempref(name, ""); - string out = defineSubst(&tempref); - // Similar code in parenthesized define (Search for END_OF_DEFARG) - //NOP: out = m_preprocp->defSubstitute(out); - if (m_defRefs.empty()) { - // Just output the substitution - unputDefrefString(out); - } else { - // Inside another define. - // Can't subst now, or - // `define a x,y - // foo(`a,`b) would break because a contains comma - V3DefineRef* refp = &(m_defRefs.top()); - refp->nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue=""; - } - goto next_tok; + out = defineSubst(&tempref); } + // Similar code in parenthesized define (Search for END_OF_DEFARG) + //NOP: out = m_preprocp->defSubstitute(out); + if (m_defRefs.empty()) { + // Just output the substitution + if (!m_off) unputDefrefString(out); + } else { + // Inside another define. + // Can't subst now, or + // `define a x,y + // foo(`a,`b) would break because a contains comma + V3DefineRef* refp = &(m_defRefs.top()); + refp->nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue=""; + } + goto next_tok; } else { // Found, with parameters UINFO(4,"Defref `"< parameterized"<