NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: uyjulian on November 13, 2020, 09:08:36 PM

Title: error: `%define' expects a macro identifier error starting with NASM 2.15rc1
Post by: uyjulian on November 13, 2020, 09:08:36 PM
The following doesn't work anymore:
Code: [Select]
%define %$%1 %2
Minimized test case:
Code: [Select]
%imacro globaldef 1
%define %1 _%1
global %1
%endmacro


%define segment_code segment .text
%macro function_align 0
segment_code
align 4
%endmacro


%macro proc_start 1
%push %1
function_align
%1:
%define %$stack_restore
%assign %$arg_base 28
%assign %$var_base 4
push edi
push esi
push ebx
push ecx
push edx
push ebp
mov ebp, esp
%endmacro


%macro proc_name_def 2
; VVV ISSUE CODE
%define %$%1 %2
; ^^^ ISSUE CODE
%endmacro


%macro proc_arg 2
proc_name_def %2, ebp+%$arg_base
%assign %$arg_base %$arg_base+%1
%endmacro


globaldef test_func

function_align
proc_start test_func
proc_arg 4, test_arg

In nasm 2.15rc1, the following occurs:
Code: [Select]
min.nas:49: error: `%define' expects a macro identifier
min.nas:40: ... from macro `proc_arg' defined here
min.nas:35: ... from macro `proc_name_def' defined here
The sample test case above assembles successfully with nasm 2.14.03rc2. Possible regression?
Title: Re: error: `%define' expects a macro identifier error starting with NASM 2.15rc1
Post by: Frank Kotler on November 14, 2020, 01:37:00 AM
Hi uyjulian,

Welcome to the forum.

Bug reports might be better filed with:
https://bugzilla.nasm.us/

Have you tried it with a space in it?

Best,
Frank


Title: Re: error: `%define' expects a macro identifier error starting with NASM 2.15rc1
Post by: uyjulian on November 14, 2020, 02:26:10 AM
I have tried with a space, and it still does the same thing:
%define %$ %1 %2

I created the bug here: https://bugzilla.nasm.us/show_bug.cgi?id=3392722