[Nasm-bugs] [Bug 3392543] Pain with %arg names in macro expansions

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Fri Jan 4 10:10:41 PST 2019


https://bugzilla.nasm.us/show_bug.cgi?id=3392543

--- Comment #6 from James Harris <james.harris.1 at gmail.com> ---
(In reply to H. Peter Anvin from comment #4)
> One way to make it work might be to save away a list of the arguments in a
> macro and %undef them all in your endproc macro.
> 
> The other option is of course to prefix the macros with %$.
> 
> You may also want to consider if you actually need a frame pointer (one of
> the things that makes this stuff needlessly expensive, and why I think it is
> bogus as designed.

I can't see how %$ can work for this. Maybe it would if parameters were named
in the macro definition but they are not, being simply specified with such as
1-*. 

I can see that the other workaround, to undef symbols, might work BUT it would
need the /names/ of parameters to be recognised in the macro code. Is that
possible? For example, a macro M could be invoked as

  M p

and the macro code would need to recognise the name "p" in order to undef it. 

I have to say that even if such a name could be recognised, I think simple
parameter names would need to be distinguished from other parameters such as
register names and expressions. For example, a macro M could be invoked as

  M dword [ebp + 4], p, eax, dword [number]

Of those, p woud need to be recognised as needing to be undef'd while the
others would need not to be

In other words, any workaround to this seems very awkward, even if possible. It
would be good if a future update of Nasm could keep the names of actual
parameters local to macros. I can't see a reason for them to persist between
macros.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list