Fix preprocessing commas in deep parameterized macros.
This commit is contained in:
parent
1a0de753e9
commit
d37cc5a160
2
Changes
2
Changes
|
|
@ -13,6 +13,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||
|
||||
**** Don't require SYSTEMPERL_INCLUDE if SYSTEMPERL/src exists. [Gary Thomas]
|
||||
|
||||
**** Fix preprocessing commas in deep parameterized macros. [Brad Dobbie]
|
||||
|
||||
**** Fix tracing escaped dotted identifiers, bug107.
|
||||
|
||||
**** Fix $display with uppercase %M.
|
||||
|
|
|
|||
|
|
@ -794,6 +794,7 @@ int V3PreProcImp::getToken() {
|
|||
if (m_defRefs.empty()) v3fatalSrc("Shouldn't be in DEFARG w/o active defref");
|
||||
V3DefineRef* refp = &(m_defRefs.top());
|
||||
refp->nextarg(refp->nextarg()+m_lexp->m_defValue); m_lexp->m_defValue="";
|
||||
UINFO(4,"defarg++ "<<refp->nextarg()<<endl);
|
||||
if (tok==VP_DEFARG && yyleng==1 && yytext[0]==',') {
|
||||
refp->args().push_back(refp->nextarg());
|
||||
m_state = ps_DEFARG;
|
||||
|
|
@ -806,13 +807,17 @@ int V3PreProcImp::getToken() {
|
|||
// Substitute in and prepare for next action
|
||||
// Similar code in non-parenthesized define (Search for END_OF_DEFARG)
|
||||
m_defRefs.pop();
|
||||
m_lexp->unputString(out.c_str());
|
||||
if (m_defRefs.empty()) {
|
||||
m_lexp->unputString(out.c_str());
|
||||
m_state = ps_TOP;
|
||||
m_lexp->m_parenLevel = 0;
|
||||
}
|
||||
else { // Finished a defref inside a upper defref
|
||||
// Can't subst now, or
|
||||
// `define a(ign) x,y
|
||||
// foo(`a(ign),`b) would break because a contains comma
|
||||
refp = &(m_defRefs.top()); // We popped, so new top
|
||||
refp->nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue="";
|
||||
m_lexp->m_parenLevel = refp->parenLevel();
|
||||
m_state = ps_DEFARG;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,4 +191,10 @@ Line_Preproc_Check 131
|
|||
(x,y )
|
||||
Line_Preproc_Check 144
|
||||
|
||||
`line 146 "t/t_preproc.v" 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
x,y)--bee submacro has comma paren
|
||||
`line 152 "t/t_preproc.v" 2
|
||||
|
|
|
|||
|
|
@ -143,3 +143,9 @@ Line_Preproc_Check `__LINE__
|
|||
)
|
||||
Line_Preproc_Check `__LINE__
|
||||
|
||||
//======================================================================
|
||||
// misparsed comma in submacro
|
||||
`define sb bee
|
||||
`define sa(l) x,y)
|
||||
`define sfoo(q,r) q--r
|
||||
`sfoo(`sa(el),`sb) submacro has comma paren
|
||||
|
|
|
|||
Loading…
Reference in New Issue