[v2,11/65] cris: use is_whitespace()

Message ID f4d86877-f026-492f-af58-4674bbe7e847@suse.com
State New
Headers
Series gas: whitespace handling |

Commit Message

Jan Beulich Jan. 27, 2025, 4:10 p.m. UTC
  Wherever blanks are permissible in input, tabs ought to be permissible,
too. This is particularly relevant when -f is passed to gas (alongside
appropriate input). Also switch ISSPACE() uses over.
---
v2: New.
  

Comments

Hans-Peter Nilsson Jan. 27, 2025, 4:22 p.m. UTC | #1
> Date: Mon, 27 Jan 2025 17:10:32 +0100
> From: Jan Beulich <jbeulich@suse.com>

> Wherever blanks are permissible in input, tabs ought to be permissible,
> too. This is particularly relevant when -f is passed to gas (alongside
> appropriate input). Also switch ISSPACE() uses over.

Hm... This code is supposed to handle formatted input
(#NO_APP in effect; format being simplified,
"canonicalized") so aren't the TABs supposed to be gone
here, whitespaces changed into a single space character?

brgds, H-P
  

Patch

--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -1540,13 +1540,15 @@  cris_process_instruction (char *insn_tex
       modified_char = *operands;
       /* Fall through.  */
 
-    case ' ':
+    zap_char:
       /* Consume the character after the mnemonic
 	 and replace it with '\0'.  */
       *operands++ = '\0';
       break;
 
     default:
+      if (is_whitespace (*operands))
+	goto zap_char;
       as_bad (_("Unknown opcode: `%s'"), insn_text);
       return;
     }
@@ -1608,12 +1610,16 @@  cris_process_instruction (char *insn_tex
 	    case '[':
 	    case ']':
 	    case ',':
-	    case ' ':
 	      /* These must match exactly.  */
 	      if (*s++ == *args)
 		continue;
 	      break;
 
+	    case ' ':
+	      if (is_whitespace (*s++))
+		continue;
+	      break;
+
 	    case 'A':
 	      /* "ACR", case-insensitive.
 		 Handle a sometimes-mandatory dollar sign as register
@@ -1682,7 +1688,7 @@  cris_process_instruction (char *insn_tex
 	      if (modified_char == '.' && *s == '.')
 		{
 		  if ((s[1] != 'd' && s[1] == 'D')
-		      || ! ISSPACE (s[2]))
+		      || ! is_whitespace (s[2]))
 		    break;
 		  s += 2;
 		  continue;
@@ -3231,7 +3237,7 @@  get_flags (char **cPP, int *flagsp)
 	     whitespace.  Anything else, and we consider it a failure.  */
 	  if (**cPP != ','
 	      && **cPP != 0
-	      && ! ISSPACE (**cPP))
+	      && ! is_whitespace (**cPP))
 	    return 0;
 	  else
 	    return 1;
@@ -4278,7 +4284,7 @@  cris_arch_from_string (const char **str)
       int len = strlen (ap->name);
 
       if (strncmp (*str, ap->name, len) == 0
-	  && (str[0][len] == 0 || ISSPACE (str[0][len])))
+	  && (is_end_of_stmt (str[0][len]) || is_whitespace (str[0][len])))
 	{
 	  *str += strlen (ap->name);
 	  return ap->arch;