At the end of its expand_smacro() function the
preprocessor performs token concatenation. If
something gets concatenated, then a re-scan of
the line will occur. This can lead to endless
loops, which will hang NASM.
For example:
%define one both
%define two 123
%define both123 one %+ two
both123 ; hangs
Or:
%push c
%define %$one %$
%define %$two both
%define %$both %$one%$two
%$both ; hangs
%pop
I'm not sure whether this should be fixed, or
merely documented as expected behavior.
Ideally token concatenation would be optional,
so that the user could enable/disable it.
Logged In: YES
user_id=804543
See SF #839196 for my solution.
Logged In: YES
user_id=804543
Said re-scan has another side effect. For example:
%push c
%assign %$n 1
%assign %$a%$n 2
db %$a1
%undef %$a1 ; works
%assign %$n 1
%assign %$a%$n 2
db %$a1
%undef %$a%$n ; fails
%pop
In this case the second %UNDEF will concatenate to "a1"
but then expand to "2" due to the re-scan. This causes
the directive to fail, because "2" isn't an identifier.
That said, I have come to believe that concatenation --
if performed properly -- is a good thing, but that the
re-scan must be optional, and default to "disabled".
Logged In: YES
user_id=804543
In my local forked version I have added "%^" as a means
to achieve explicit recursion during single-line macro
expansion. Please see SF #950642 for details.