[nasm:nasm-2.15.xx] listing: list short reserved blocks as ?? instead of <res ...>

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Sat Jun 27 23:33:03 PDT 2020


Commit-ID:  43a72dd6386864b64c0d6f77b10cab007c024285
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=43a72dd6386864b64c0d6f77b10cab007c024285
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Sat, 27 Jun 2020 23:30:33 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Sat, 27 Jun 2020 23:30:33 -0700

listing: list short reserved blocks as ?? instead of <res ...>

<res ...> can get rather annoying when mixed in with data, as can
happen with the MASM-like db syntax. List shorter blocks (8 bytes or
less) as ?? instead; 8 bytes avoids line breaks for a single
statement.

This is probably more readable anyway...

Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/listing.c |  9 +++++++--
 test/dup.asm  | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/asm/listing.c b/asm/listing.c
index 9b101ff4..6d6f3606 100644
--- a/asm/listing.c
+++ b/asm/listing.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 1996-2019 The NASM Authors - All Rights Reserved
+ *   Copyright 1996-2020 The NASM Authors - All Rights Reserved
  *   See the file AUTHORS included with the NASM distribution for
  *   the specific copyright holders.
  *
@@ -276,8 +276,13 @@ static void list_output(const struct out_data *data)
 	break;
     case OUT_RESERVE:
     {
-        if (size)
+        if (size > 8) {
             list_size(offset, "res", size);
+        } else {
+            memset(q, '?', size << 1);
+            q[size << 1] = '\0';
+            list_out(offset, q);
+        }
 	break;
     }
     default:
diff --git a/test/dup.asm b/test/dup.asm
index 723da48b..62785628 100644
--- a/test/dup.asm
+++ b/test/dup.asm
@@ -19,3 +19,18 @@
 
 	dd 16 dup (0xaaaa, ?, 0xbbbbbb)
 	dd 64 dup (?)
+
+	resb 1
+	resb 2
+	resb 4
+	resb 8
+
+	resw 1
+	resw 2
+	resw 4
+	resw 8
+
+	resq 1
+	resq 2
+	resq 4
+	resq 8


More information about the Nasm-commits mailing list