summaryrefslogtreecommitdiff
path: root/preproc.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-24 16:38:17 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-24 16:38:17 -0700
commit264b7b982cd23ee4a47ac6c4eaf89b05564e46f0 (patch)
tree3ffa3a74fd92702fb9cd70816904581e2d68e967 /preproc.c
parent0b7d903ec84b43a339f3febfe95a1e7dd5d03e54 (diff)
downloadnasm-264b7b982cd23ee4a47ac6c4eaf89b05564e46f0.tar.gz
preproc: don't macro-expand the argument to %use
Use expand_id() for the argument to %use, instead of expand_smacro(). This really makes more sense for a "naked" argument. This is a semantic change, but is unlikely to break any real code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'preproc.c')
-rw-r--r--preproc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/preproc.c b/preproc.c
index fa9bf3d4..ea86dcb5 100644
--- a/preproc.c
+++ b/preproc.c
@@ -2310,24 +2310,25 @@ static int do_directive(Token * tline)
static macros_t *use_pkg;
const char *pkg_macro;
- t = tline->next = expand_smacro(tline->next);
- skip_white_(t);
+ tline = tline->next;
+ skip_white_(tline);
+ tline = expand_id(tline);
- if (!t || (t->type != TOK_STRING &&
- t->type != TOK_INTERNAL_STRING &&
- t->type != TOK_ID)) {
+ if (!tline || (tline->type != TOK_STRING &&
+ tline->type != TOK_INTERNAL_STRING &&
+ tline->type != TOK_ID)) {
error(ERR_NONFATAL, "`%%use' expects a package name");
free_tlist(origline);
return DIRECTIVE_FOUND; /* but we did _something_ */
}
- if (t->next)
+ if (tline->next)
error(ERR_WARNING|ERR_PASS1,
"trailing garbage after `%%use' ignored");
- if (t->type == TOK_STRING)
- nasm_unquote(t->text, NULL);
- use_pkg = nasm_stdmac_find_package(t->text);
+ if (tline->type == TOK_STRING)
+ nasm_unquote(tline->text, NULL);
+ use_pkg = nasm_stdmac_find_package(tline->text);
if (!use_pkg)
- error(ERR_NONFATAL, "unknown `%%use' package: %s", t->text);
+ error(ERR_NONFATAL, "unknown `%%use' package: %s", tline->text);
/* The first string will be <%define>__USE_*__ */
pkg_macro = (char *)use_pkg + 1;
if (!smacro_defined(NULL, pkg_macro, 0, NULL, true)) {