Fix `define argument mis-replacing system task of same name, bug191.

This commit is contained in:
Wilson Snyder 2009-11-23 14:26:04 -05:00
parent 2f2f367c0b
commit af5aa38bc3
4 changed files with 16 additions and 1 deletions

View File

@ -26,6 +26,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Support for loop i++, ++i, i--, --i, bug175. [by Byron Bradley] **** Support for loop i++, ++i, i--, --i, bug175. [by Byron Bradley]
**** Fix `define argument mis-replacing system task of same name, bug191.
**** Fix Verilator core dump on wide integer divides, bug178. [Byron Bradley] **** Fix Verilator core dump on wide integer divides, bug178. [Byron Bradley]
* Verilator 3.720 2009/10/26 * Verilator 3.720 2009/10/26

View File

@ -462,6 +462,7 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) {
//cout << "CH "<<*cp<<" an "<<argName<<"\n"; //cout << "CH "<<*cp<<" an "<<argName<<"\n";
if (!quote) { if (!quote) {
if ( isalpha(*cp) || *cp=='_' if ( isalpha(*cp) || *cp=='_'
|| *cp=='$' // Won't replace system functions, since no $ in argValueByName
|| (argName!="" && (isdigit(*cp) || *cp=='$'))) { || (argName!="" && (isdigit(*cp) || *cp=='$'))) {
argName += *cp; argName += *cp;
continue; continue;

View File

@ -196,5 +196,11 @@ Line_Preproc_Check 144
x,y)--bee submacro has comma paren x,y)--bee submacro has comma paren
`line 152 "t/t_preproc.v" 2
$display("bits %d %d", $bits(foo), `10);
`line 158 "t/t_preproc.v" 2

View File

@ -146,6 +146,12 @@ Line_Preproc_Check `__LINE__
//====================================================================== //======================================================================
// misparsed comma in submacro // misparsed comma in submacro
`define sb bee `define sb bee
`define appease_emacs_paren_matcher (
`define sa(l) x,y) `define sa(l) x,y)
`define sfoo(q,r) q--r `define sfoo(q,r) q--r
`sfoo(`sa(el),`sb) submacro has comma paren `sfoo(`sa(el),`sb) submacro has comma paren
//======================================================================
// bug191
`define bug191(bits) $display("bits %d %d", $bits(foo), `bits);
`bug191(10)