summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-09-18 02:59:08 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-09-18 02:59:08 +0400
commit8fe1f65087dfa40e351b4afceb3c9b5b1f985d91 (patch)
tree1b7d29d5f9c8e8f3cf1aaee120c581c6e7b98b85
parent14ad688d354f4bdbcfd161143945106a43b1a48a (diff)
parentaf6be576ac23004708f2698a720030e7c7fcbb58 (diff)
downloadnasm-8fe1f65087dfa40e351b4afceb3c9b5b1f985d91.tar.gz
Merge branch 'nasm-2.09.xx'
-rw-r--r--doc/changes.src4
-rw-r--r--preproc.c30
-rw-r--r--test/br3066383.asm68
-rw-r--r--version2
4 files changed, 103 insertions, 1 deletions
diff --git a/doc/changes.src b/doc/changes.src
index 5a51177e..de6b0510 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -29,6 +29,10 @@ To force a specific form, use the \c{STRICT} keyword, see \k{strict}.
\b Fix typo in documentation.
+\b Compound context local preprocessor single line macro identifiers
+ were not expanded early enough and as result lead to unresolved
+ symbols.
+
\S{cl-2.09.01} Version 2.09.01
diff --git a/preproc.c b/preproc.c
index 88c288ef..f9a2f859 100644
--- a/preproc.c
+++ b/preproc.c
@@ -3659,6 +3659,7 @@ static bool paste_tokens(Token **head, bool handle_paste_tokens)
}
break;
case TOK_ID:
+ case TOK_PREPROC_ID:
case TOK_NUMBER:
case TOK_FLOAT:
{
@@ -3971,6 +3972,35 @@ static Token *expand_mmac_params(Token * tline)
}
delete_Token(t);
changed = true;
+ } else if (tline->type == TOK_PREPROC_ID &&
+ tline->text[0] == '%' &&
+ tline->text[1] == '$' &&
+ !tok_type_(tline->next, TOK_WHITESPACE) &&
+ (tok_type_(tline->next, TOK_ID) ||
+ tok_type_(tline->next, TOK_PREPROC_ID) ||
+ tok_type_(tline->next, TOK_NUMBER) ||
+ tok_type_(tline->next, TOK_OTHER) ||
+ tok_type_(tline->next, TOK_FLOAT))) {
+ /*
+ * In a sake of backward compatibility we allow
+ * to expand local single macro that early before
+ * pasting token code have place
+ *
+ * NOTE: that new code MUST use %+ macro to obtain
+ * same result
+ */
+ t = tline;
+ tline = tline->next;
+ tt = tokenize(t->text);
+ tt = expand_smacro(tt);
+ *tail = tt;
+ while (tt) {
+ tt->a.mac = NULL;
+ tail = &tt->next;
+ tt = tt->next;
+ }
+ delete_Token(t);
+ changed = true;
} else {
t = *tail = tline;
tline = tline->next;
diff --git a/test/br3066383.asm b/test/br3066383.asm
new file mode 100644
index 00000000..09222ac7
--- /dev/null
+++ b/test/br3066383.asm
@@ -0,0 +1,68 @@
+;
+; this is a for BR3005117
+; http://sourceforge.net/tracker/?func=detail&aid=3005117&group_id=6208&atid=106208
+;
+%macro b_struc 1-*
+ %push foo
+ %define %$strucname %1
+%%top_%$strucname:
+ %rep %0 - 1
+ %rotate 1
+ resb %{$strucname}%1 - ($ - %%top_%$strucname)
+%1:
+ %endrep
+ resb %{$strucname}_size - ($ - %%top_%$strucname)
+ %pop
+%endmacro
+
+struc timeval
+ .tv_sec resd 1
+ .tv_usec resd 1
+endstruc
+
+section .text
+ mov [timeval_struct.tv_sec], eax
+
+section .bss
+ timeval_struct b_struc timeval, .tv_sec, .tv_usec
+ timeval_struct_len equ $ - timeval_struct
+
+section .text
+
+;
+; this is a test for BR3026808
+; http://sourceforge.net/tracker/?func=detail&aid=3026808&group_id=6208&atid=106208
+;
+%imacro proc 1
+ %push proc
+ %assign %$arg 1
+%endmacro
+
+%imacro arg 0-1 1
+ %assign %$arg %1+%$arg
+%endmacro
+
+%imacro endproc 0
+ %pop
+%endmacro
+
+proc Test
+ %$ARG arg
+endproc
+
+;
+; this is a test for BR3066383
+; http://sourceforge.net/tracker/?func=detail&aid=3066383&group_id=6208&atid=106208
+;
+%macro pp_local 1
+ %push
+ %assign %$_uses 0
+ %rep 4
+ %assign %$_ur%$_uses %$_uses
+ mov ecx, %$_ur%$_uses
+ %assign %$_uses %$_uses+1
+ %endrep
+ %pop
+%endmacro
+
+pp_local 1
diff --git a/version b/version
index 211192b0..401fc593 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-2.09.01
+2.09.02