[06/11] gas: re-work tic6x scrubber special case

Message ID d3aae0b5-2e58-4538-b707-80d60439dd35@suse.com
State Superseded
Headers
Series gas: scrubber adjustments |

Commit Message

Jan Beulich June 28, 2024, 1:20 p.m. UTC
  Two successive PUT() without a state change in between can't be right:
The first PUT() may take the "goto tofull" path, leading to the
subsequent character being processed later in the previously set state
(1 in this case), rather than the state we were in upon entry to the
switch() (13 in this case). Move to state 2 instead, thus forcing the
retaining of possible whitespace between "||" and a subsequent '>',
making sure not to mistake that for "||>".
---
While running the testsuite suggests this is okay a change to make just
on its own, if this was assumed to cause issues by the tic6x maintainer
merely because of issues with whitespace between what the states
description calls "opcode" and "operands" right now, this would need
folding into the subsequent "gas: have scrubber retain more whitespace".

The assumption here is (as the new comment says) that no label may
follow the "||" or "||>". In fact, if that assumption was true for all
targets setting DOUBLEBAR_PARALLEL, the #ifdef could be avoided
altogether, the latest with said subsequent "gas: have scrubber retain
more whitespace".
  

Patch

--- a/gas/app.c
+++ b/gas/app.c
@@ -685,20 +685,16 @@  do_scrub_chars (size_t (*get) (char *, s
 	  if (ch != '|')
 	    abort ();
 
+#ifndef TC_TIC6X
 	  /* Reset back to state 1 and pretend that we are parsing a
 	     line from just after the first white space.  */
 	  state = 1;
-	  PUT ('|');
-#ifdef TC_TIC6X
-	  /* "||^" is used for SPMASKed instructions.  */
-	  ch = GET ();
-	  if (ch == EOF)
-	    goto fromeof;
-	  else if (ch == '^')
-	    PUT ('^');
-	  else
-	    UNGET (ch);
+#else
+	  /* Don't permit white space between "||" and a possible '>'.  There
+	     shouldn't be any labels subsequent to that anyway.  */
+	  state = 2;
 #endif
+	  PUT ('|');
 	  continue;
 #endif
 #ifdef TC_Z80