[nasm:master] preproc: move reverse_tokens() into define_smacro()

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Fri Jul 10 01:15:03 PDT 2020


Commit-ID:  93dd437ac9c67acc6fdab4203c7f6c7864e2dc90
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=93dd437ac9c67acc6fdab4203c7f6c7864e2dc90
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Fri, 10 Jul 2020 00:56:03 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Fri, 10 Jul 2020 00:56:03 -0700

preproc: move reverse_tokens() into define_smacro()

The fact that smac->expansion is stored in reverse order is a detail
of the implementation, and should not be forced on the caller of
define_smacro().

Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/preproc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index c342d0a5..1c29b4c0 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -3042,7 +3042,7 @@ static SMacro *define_smacro(const char *mname, bool casesense,
 
     smac->name      = nasm_strdup(mname);
     smac->casesense = casesense;
-    smac->expansion = expansion;
+    smac->expansion = reverse_tokens(expansion);
     smac->expand    = smacro_expand_default;
     if (tmpl) {
         smac->nparam     = tmpl->nparam;
@@ -4364,8 +4364,7 @@ issue_error:
                     mark_smac_params(tline, &tmpl, TOK_XDEF_PARAM);
                 tline = expand_smacro(tline);
             }
-            /* NB: Does this still make sense? */
-            macro_start = reverse_tokens(tline);
+            macro_start = tline;
         }
 
         /*
@@ -4432,7 +4431,7 @@ issue_error:
          * are stored with the token stream reversed, so we have to
          * reverse the output of tokenize().
          */
-        macro_start = reverse_tokens(tokenize(unquote_token_cstr(t)));
+        macro_start = tokenize(unquote_token_cstr(t));
 
         /*
          * We now have a macro name, an implicit parameter count of


More information about the Nasm-commits mailing list