[Nasm-bugs] [Bug 3392627] %rep listing swallows %[...] brackets

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Thu Oct 24 06:38:03 PDT 2019


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

--- Comment #2 from C. Masloch <pushbx at ulukai.org> ---
Found a way to use %[...] usefully with multi-line macro parameter expansion.
Note here how the expansions for both mac1 and mac2 look the same in the
listing, but the mac1 one emits the symbol data1 while the mac2 one emits
dataii_suffix.


$ cat test3.asm

[map symbols brief test3.map]

        %macro mac1 1
data%[%1_suffix]:
        %endmacro

        %macro mac2 1
data%1_suffix:
        %endmacro

%define ii_suffix 1
        mac1 ii
        mac2 ii
$ nasm test3.asm -l test3.lst
$ cat test3.lst
     1                                  
     2                                  [map symbols brief test3.map]
     3                                  
     4                                          %macro mac1 1
     5                                  data%[%1_suffix]:
     6                                          %endmacro
     7                                  
     8                                          %macro mac2 1
     9                                  data%1_suffix:
    10                                          %endmacro
    11                                  
    12                                  %define ii_suffix 1
    13                                          mac1 ii
     5                              <1> data%1_suffix:
    14                                          mac2 ii
     9                              <1> data%1_suffix:
$ cat test3.map

- NASM Map file ---------------------------------------------------------------

Source file:  test3.asm
Output file:  test3

-- Program origin -------------------------------------------------------------

00000000

-- Sections (summary) ---------------------------------------------------------

Vstart            Start             Stop              Length    Class     Name
               0                 0                 0  00000000  progbits  .text

-- Symbols --------------------------------------------------------------------

---- Section .text ------------------------------------------------------------

Real              Virtual           Name
               0                 0  data1
               0                 0  dataii_suffix

$

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


More information about the Nasm-bugs mailing list