Fix GitHub issue #374 - ordering of `` and embedded macro expansion.
The IEEE standard does not clearly state whether the `` directive is applied before or after embedded macros are expanded. Other simulators vary in their behaviour. For maximum compatibility, this fix adopts the behaviour found in Verilator, where `prefix``suffix expands to <prefix>suffix if prefix is a defined macro, otherwise it expands to <prefixsuffix> (where <...> is the expanded macro text). Other simulators show this behaviour in at least some circumstances.
This commit is contained in:
parent
8f8737198c
commit
6566072741
|
|
@ -154,9 +154,9 @@ static void ifdef_leave(void)
|
|||
result = (rc == 0) ? YY_NULL : rc; \
|
||||
} else { \
|
||||
/* We are expanding a macro. Handle the SV `` delimiter. \
|
||||
If the delimiter terminates a compiler directive, leave \
|
||||
If the delimiter terminates a defined macro usage, leave \
|
||||
it in place, otherwise remove it now. */ \
|
||||
if (yytext[0] != '`') { \
|
||||
if (!(yytext[0] == '`' && is_defined(yytext+1))) { \
|
||||
while ((istack->str[0] == '`') && \
|
||||
(istack->str[1] == '`')) { \
|
||||
istack->str += 2; \
|
||||
|
|
|
|||
Loading…
Reference in New Issue