public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] gas: re-arrange listing output for .irp and alike
@ 2022-12-22 13:31 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2022-12-22 13:31 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a5ce326cfeb364a33d8ee9c806780347a92b5d18

commit a5ce326cfeb364a33d8ee9c806780347a92b5d18
Author: Jan Beulich <jbeulich@suse.com>
Date:   Thu Dec 22 14:31:11 2022 +0100

    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.

Diff:
---
 gas/listing.c                       | 24 ++++++++++++------------
 gas/testsuite/gas/i386/noavx512-1.l |  4 ++--
 2 files changed, 14 insertions(+), 14 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;
 	}
diff --git a/gas/testsuite/gas/i386/noavx512-1.l b/gas/testsuite/gas/i386/noavx512-1.l
index 86e852731e1..655a90de2ce 100644
--- a/gas/testsuite/gas/i386/noavx512-1.l
+++ b/gas/testsuite/gas/i386/noavx512-1.l
@@ -45,6 +45,8 @@
 [ 	]*[0-9]+[ 	]*
 [ 	]*[0-9]+[ 	]+\.irp isa, default, .*
 #...
+[ 	]*[0-9]+[ 	]+\.endr
+#...
 [ 	]*[0-9]+[ 	]+>  \.arch default
 [ 	]*[0-9]+[ 	]+>  \.arch default
 [ 	]*[0-9]+[ 	]+\?\?\?\? 62F27D4F 	>  vpabsb %zmm5,%zmm6\{%k7\}
@@ -399,8 +401,6 @@
 [ 	]*[0-9]+[ 	]+>  vpermb %xmm4,%xmm5,%xmm6\{%k7\}
 [ 	]*[0-9]+[ 	]+>  vpermb %ymm4,%ymm5,%ymm6\{%k7\}
 #...
-[ 	]*[0-9]+[ 	]+\.endr
-[ 	]*[0-9]+[ 	]*
 [ 	]*[0-9]+[ 	]+\?\?\?\? C4E2791C 		vpabsb %xmm5, %xmm6
 [ 	]*[0-9]+[ 	]+F5
 [ 	]*[0-9]+[ 	]+\?\?\?\? C4E27D1C 		vpabsb %ymm5, %ymm6

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-22 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 13:31 [binutils-gdb] gas: re-arrange listing output for .irp and alike Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).