diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-02-11 15:12:19 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-02-11 21:28:41 +0300 |
commit | c56d9ad350684c0b8963d2d370fa1c53718f5548 (patch) | |
tree | 2db860f54ada709522da928d891b80ff1801e69d /preproc.c | |
parent | 3cbd9e72152bb1aa105793eb177385a02ac3dbb1 (diff) | |
download | nasm-c56d9ad350684c0b8963d2d370fa1c53718f5548.tar.gz nasm-c56d9ad350684c0b8963d2d370fa1c53718f5548.tar.bz2 nasm-c56d9ad350684c0b8963d2d370fa1c53718f5548.zip |
expand_smacro: Don't search for ID in global context
The corner case is the code like
%define foo 1
%push bar
%$foo:
%pop
for which v2.07 ends up with "foo = 1" while 0.98.39
issue an error.
hpa said that ideally we may need to create a context
structure for the global context but this seems to be
too agressive for 2.08.
Based on patch from nasm64developer
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'preproc.c')
-rw-r--r-- | preproc.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -3747,7 +3747,6 @@ static Token *expand_mmac_params(Token * tline) static Token *expand_smacro(Token * tline) { Token *t, *tt, *mstart, **tail, *thead; - struct hash_table *smtbl; SMacro *head = NULL, *m; Token **params; int *paramsize; @@ -3788,12 +3787,13 @@ again: if ((mname = tline->text)) { /* if this token is a local macro, look in local context */ - if (tline->type == TOK_ID || tline->type == TOK_PREPROC_ID) + if (tline->type == TOK_ID) { + head = (SMacro *)hash_findix(&smacros, mname); + } else if (tline->type == TOK_PREPROC_ID) { ctx = get_ctx(mname, &mname, true); - else - ctx = NULL; - smtbl = ctx ? &ctx->localmac : &smacros; - head = (SMacro *) hash_findix(smtbl, mname); + head = ctx ? (SMacro *)hash_findix(&ctx->localmac, mname) : NULL; + } else + head = NULL; /* * We've hit an identifier. As in is_mmacro below, we first |