Fix parametrized defines calling define with comma. [Joshua Wise]

git-svn-id: file://localhost/svn/verilator/trunk/verilator@1048 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder
2008-05-06 01:11:21 +00:00
parent d2d38edf06
commit 9dade8fbd9
4 changed files with 41 additions and 4 deletions
+10 -1
View File
@@ -911,7 +911,16 @@ int V3PreProcImp::getToken() {
string out = defValue(name);
UINFO(4,"Defref `"<<name<<" => '"<<out<<"'"<<endl);
// Similar code in parenthesized define (Search for END_OF_DEFARG)
m_lexp->unputString(out.c_str());
if (m_defRefs.empty()) {
// Just output the substitution
m_lexp->unputString(out.c_str());
} 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