[binutils-gdb] rx: use is_whitespace()

Jan Beulich jbeulich@sourceware.org
Mon Feb 3 11:21:01 GMT 2025


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

commit f983b224f8fc35adc87d67539e8d669daf7a0c34
Author: Jan Beulich <jbeulich@suse.com>
Date:   Mon Feb 3 12:19:26 2025 +0100

    rx: 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 open-coded checks as well as ISSPACE()
    uses. At the same time use is_end_of_stmt() instead of an open-coded
    check in adjacent code.

Diff:
---
 gas/config/rx-parse.y |  2 +-
 gas/config/tc-rx.c    | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gas/config/rx-parse.y b/gas/config/rx-parse.y
index 60ff2fc0a1e..31dad513091 100644
--- a/gas/config/rx-parse.y
+++ b/gas/config/rx-parse.y
@@ -1583,7 +1583,7 @@ rx_lex (void)
   unsigned int ci;
   char * save_input_pointer;
 
-  while (ISSPACE (*rx_lex_start)
+  while (is_whitespace (*rx_lex_start)
 	 && rx_lex_start != rx_lex_end)
     rx_lex_start ++;
 
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 7a426d281df..bd45c53cfa0 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -282,7 +282,8 @@ rx_include (int ignore)
   last_char = find_end_of_line (filename, false);
   input_line_pointer = last_char;
 
-  while (last_char >= filename && (* last_char == ' ' || * last_char == '\n'))
+  while (last_char >= filename
+	 && (is_whitespace (* last_char) || is_end_of_stmt (* last_char)))
     -- last_char;
   end_char = *(++ last_char);
   * last_char = 0;
@@ -425,14 +426,14 @@ parse_rx_section (char * name)
 	{
 	  *p = end_char;
 
-	  if (end_char == ' ')
-	    while (ISSPACE (*p))
+	  if (is_whitespace (end_char))
+	    while (is_whitespace (*p))
 	      p++;
 
 	  if (*p == '=')
 	    {
 	      ++ p;
-	      while (ISSPACE (*p))
+	      while (is_whitespace (*p))
 		p++;
 	      switch (*p)
 		{
@@ -517,7 +518,7 @@ rx_section (int ignore)
     {
       int len = p - input_line_pointer;
 
-      while (ISSPACE (*++p))
+      while (is_whitespace (*++p))
 	;
 
       if (*p != '"' && *p != '#')
@@ -1060,7 +1061,7 @@ rx_equ (char * name, char * expression)
   char * name_end;
   char * saved_ilp;
 
-  while (ISSPACE (* name))
+  while (is_whitespace (* name))
     name ++;
 
   for (name_end = name + 1; *name_end; name_end ++)
@@ -1094,7 +1095,7 @@ scan_for_infix_rx_pseudo_ops (char * str)
     return false;
 
   /* A real pseudo-op must be preceded by whitespace.  */
-  if (dot[-1] != ' ' && dot[-1] != '\t')
+  if (!is_whitespace (dot[-1]))
     return false;
 
   pseudo_op = dot + 1;


More information about the Binutils-cvs mailing list