summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2016-02-17 15:35:06 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2016-02-17 15:38:51 -0800
commitd2ea49b326058cb96400e79691b4a89c6418cb91 (patch)
tree93d9635972e1adfd92a3f7aab809eea05cb01529
parent777b7b1d25b7915e8b1c8f6b6eb43ebd66f7dc3e (diff)
downloadnasm-d2ea49b326058cb96400e79691b4a89c6418cb91.tar.gz
listing: change the line numbers to match the source code
Instead of completely useless sequential line numbers, emit line numbers corresponding to the line numbers in the source code. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--doc/changes.src3
-rw-r--r--listing.c15
2 files changed, 11 insertions, 7 deletions
diff --git a/doc/changes.src b/doc/changes.src
index 67491b71..eab8439d 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -32,6 +32,9 @@ since 2007.
relocations are zero-extended from 32-bits with a warning
(suppressible via \c{}); signed 64-bit relocations are an arror.
+\b Line numbers in list files now correspond to the lines in the source
+ files, instead of simply being sequential.
+
\S{cl-2.11.09} Version 2.11.09
\b Fix potential stack overwrite in \c{macho32} backend.
diff --git a/listing.c b/listing.c
index 49f5e15d..4fcf91f8 100644
--- a/listing.c
+++ b/listing.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2016 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -73,6 +73,7 @@ static char listdata[2 * LIST_INDENT]; /* we need less than that actually */
static int32_t listoffset;
static int32_t listlineno;
+static const char *listfn;
static int32_t listp;
@@ -89,7 +90,7 @@ static void list_emit(void)
if (!listlinep && !listdata[0])
return;
- fprintf(listfp, "%6"PRId32" ", ++listlineno);
+ fprintf(listfp, "%6"PRId32" ", listlineno);
if (listdata[0])
fprintf(listfp, "%08"PRIX32" %-*s", listoffset, LIST_HEXBIT + 1,
@@ -111,7 +112,7 @@ static void list_emit(void)
listdata[0] = '\0';
if (listerror[0]) {
- fprintf(listfp, "%6"PRId32" ", ++listlineno);
+ fprintf(listfp, "%6"PRId32" ", listlineno);
for (i = 0; i < LIST_HEXBIT; i++)
putc('*', listfp);
@@ -243,10 +244,9 @@ static void list_line(int type, char *line)
{
if (!listp)
return;
- if (user_nolist) { /* fbk - 9/2/00 */
- listlineno++;
- return;
- }
+
+ if (user_nolist)
+ return;
if (mistack && mistack->inhibiting) {
if (type == LIST_MACRO)
@@ -258,6 +258,7 @@ static void list_line(int type, char *line)
}
}
list_emit();
+ listlineno = src_get_linnum();
listlinep = true;
strncpy(listline, line, LIST_MAX_LEN - 1);
listline[LIST_MAX_LEN - 1] = '\0';