[2/5] gas: squash (some) .linefile from listings

Message ID 2ae84a68-29f3-d94d-1a12-c3d0c81f81a3@suse.com
State Accepted
Headers
Series gas: diagnostics for macros and some tidying |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jan Beulich Nov. 29, 2022, 10:36 a.m. UTC
  Not so long ago we started to insert these artificially when expanding
certain macro-like constructs; zap them as cluttering what actually
results from user input.
---
We may want to also zap ones resulting from "# <line> <file>", albeit
these anyway appear in listings only when assembling from stdin. Such
zapping also would need to happen elsewhere and/or in a different
manner.

Slightly RFC: Am I at risk of zapping a label named "linefile" this way?
(At least we can assume that this directive is the only think on a line,
_if_ it is a directive, for being internal only.) If so, lifting
buffer_and_nest()'s respective logic into a helper function may be the
way to go.
  

Patch

--- a/gas/read.c
+++ b/gas/read.c
@@ -867,7 +867,10 @@  read_a_source_file (const char *name)
 		  /* Find the end of the current expanded macro line.  */
 		  s = find_end_of_line (input_line_pointer, flag_m68k_mri);
 
-		  if (s != last_eol)
+		  if (s != last_eol
+		      && !startswith (input_line_pointer,
+				      !flag_m68k_mri ? " .linefile "
+						     : " linefile "))
 		    {
 		      char *copy;
 		      size_t len;