[binutils-gdb] msp430: use is_whitespace()

Jan Beulich jbeulich@sourceware.org
Mon Feb 3 11:17:22 GMT 2025


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

commit a72e1e05281da0c58e72a5422e1ff04a1165225f
Author: Jan Beulich <jbeulich@suse.com>
Date:   Mon Feb 3 12:15:35 2025 +0100

    msp430: use is_whitespace()
    
    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 convert ISSPACE() uses. At the same time use
    is_end_of_stmt() instead of open-coded checking in code needing touching
    anyway.

Diff:
---
 gas/config/tc-msp430.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index f5c864e4016..27b1d8399a7 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -436,11 +436,11 @@ del_spaces (char * s)
 {
   while (*s)
     {
-      if (ISSPACE (*s))
+      if (is_whitespace (*s))
 	{
 	  char *m = s + 1;
 
-	  while (ISSPACE (*m) && *m)
+	  while (is_whitespace (*m) && *m)
 	    m++;
 	  memmove (s, m, strlen (m) + 1);
 	}
@@ -452,7 +452,7 @@ del_spaces (char * s)
 static inline char *
 skip_space (char * s)
 {
-  while (ISSPACE (*s))
+  while (is_whitespace (*s))
     ++s;
   return s;
 }
@@ -1813,7 +1813,7 @@ extract_cmd (char * from, char * to, int limit)
 {
   int size = 0;
 
-  while (*from && ! ISSPACE (*from) && *from != '.' && limit > size)
+  while (*from && ! is_whitespace (*from) && *from != '.' && limit > size)
     {
       *(to + size) = *from;
       from++;
@@ -2833,14 +2833,12 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
 	  check = true;
 	  break;
 
-	case 0:
-	case ' ':
-	case '\n':
-	case '\r':
-	  as_warn (_("no size modifier after period, .w assumed"));
-	  break;
-
 	default:
+	  if (is_whitespace (*line) || is_end_of_stmt(*line))
+	    {
+	      as_warn (_("no size modifier after period, .w assumed"));
+	      break;
+	    }
 	  as_bad (_("unrecognised instruction size modifier .%c"),
 		   * line);
 	  return 0;
@@ -2853,7 +2851,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
 	}
     }
 
-  if (*line && ! ISSPACE (*line))
+  if (*line && ! is_whitespace (*line))
     {
       as_bad (_("junk found after instruction: %s.%s"),
 	      opcode->name, line);


More information about the Binutils-cvs mailing list