summaryrefslogtreecommitdiff
path: root/gas/listing.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-12-22 14:31:11 +0100
committerJan Beulich <jbeulich@suse.com>2022-12-22 14:31:11 +0100
commita5ce326cfeb364a33d8ee9c806780347a92b5d18 (patch)
tree6fe651f7322048bf399bfb0d4d1e7b9afc1d6200 /gas/listing.c
parent760ab3d0dbebbcd1b7b476f38704ae2e83006adf (diff)
downloadbinutils-gdb-a5ce326cfeb364a33d8ee9c806780347a92b5d18.tar.gz
gas: re-arrange listing output for .irp and alike
It is kind of odd to have the expansions of such constructs ahead of their definition in listings with macro expansion enabled. Adjust this by pulling ahead the output of the definition lines, taking care to avoid producing a listing line for (non-existing) line 0 when the source is stdin. Note that with the code movement the conditional operator isn't necessary anymore - list->line now match up.
Diffstat (limited to 'gas/listing.c')
-rw-r--r--gas/listing.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gas/listing.c b/gas/listing.c
index 83a6f39cb31..358e14e689e 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -1247,18 +1247,7 @@ listing_listing (char *name ATTRIBUTE_UNUSED)
if (current_hll_file && list->hll_line && (listing & LISTING_HLL))
print_source (current_hll_file, list, width);
- if (list->line_contents)
- {
- if (!((listing & LISTING_NODEBUG)
- && debugging_pseudo (list, list->line_contents)))
- print_lines (list,
- list->file->linenum == 0 ? list->line : list->file->linenum,
- list->line_contents, calc_hex (list));
-
- free (list->line_contents);
- list->line_contents = NULL;
- }
- else
+ if (!list->line_contents || list->file->linenum)
{
while (list->file->linenum < list_line
&& !list->file->at_end)
@@ -1278,6 +1267,17 @@ listing_listing (char *name ATTRIBUTE_UNUSED)
}
}
+ if (list->line_contents)
+ {
+ if (!((listing & LISTING_NODEBUG)
+ && debugging_pseudo (list, list->line_contents)))
+ print_lines (list, list->line, list->line_contents,
+ calc_hex (list));
+
+ free (list->line_contents);
+ list->line_contents = NULL;
+ }
+
if (list->edict == EDICT_EJECT)
eject = 1;
}