[v2,47/65] S/390: use is_whitespace()

Message ID 099665aa-cc78-4ae7-9ddd-f4247cd18b7d@suse.com
State New
Headers
Series gas: whitespace handling |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Jan Beulich Jan. 27, 2025, 4:36 p.m. UTC
  Convert ISSPACE() uses. At the same time use is_end_of_stmt() instead
of kind-of-open-coded checks in adjacent code.
---
v2: New.
  

Comments

Jens Remus Jan. 30, 2025, 8:38 a.m. UTC | #1
On 27.01.2025 17:36, Jan Beulich wrote:
> Convert ISSPACE() uses. At the same time use is_end_of_stmt() instead
> of kind-of-open-coded checks in adjacent code.

Thanks! LGTM.

> --- a/gas/config/tc-s390.c
> +++ b/gas/config/tc-s390.c

> @@ -1916,7 +1916,7 @@ md_assemble (char *str)
>     char *s;
>   
>     /* Get the opcode.  */
> -  for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
> +  for (s = str; ! is_end_of_stmt (*s) && ! is_whitespace (*s); s++)
>       ;
>     if (*s != '\0')
>       *s++ = '\0';

I wonder whether I should look into whether to convert all of
those checks against '\0' to is_end_of_stmt()?  What are your
thoughts?

Thanks and regards,
Jens
  
Jan Beulich Jan. 30, 2025, 9:11 a.m. UTC | #2
On 30.01.2025 09:38, Jens Remus wrote:
>> --- a/gas/config/tc-s390.c
>> +++ b/gas/config/tc-s390.c
> 
>> @@ -1916,7 +1916,7 @@ md_assemble (char *str)
>>     char *s;
>>   
>>     /* Get the opcode.  */
>> -  for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
>> +  for (s = str; ! is_end_of_stmt (*s) && ! is_whitespace (*s); s++)
>>       ;
>>     if (*s != '\0')
>>       *s++ = '\0';
> 
> I wonder whether I should look into whether to convert all of
> those checks against '\0' to is_end_of_stmt()?  What are your
> thoughts?

Quite likely, unless I didn't spot where the nul char is put in place
(and I will admit I didn't try very hard, as that wouldn't have scaled
very well with the many architectures that needed touching; IOW I went
from the assumption that it's better to go a little too far with
converting, which can always be undone later on by arch maintainers).

Jan
  

Patch

--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1429,7 +1429,7 @@  md_gather_operands (char *str,
   char *f;
   int fc, i;
 
-  while (ISSPACE (*str))
+  while (is_whitespace (*str))
     str++;
 
   /* Gather the operands.  */
@@ -1811,7 +1811,7 @@  md_gather_operands (char *str,
 	}
     }
 
-  while (ISSPACE (*str))
+  while (is_whitespace (*str))
     str++;
 
   /* Check for tls instruction marker.  */
@@ -1916,7 +1916,7 @@  md_assemble (char *str)
   char *s;
 
   /* Get the opcode.  */
-  for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
+  for (s = str; ! is_end_of_stmt (*s) && ! is_whitespace (*s); s++)
     ;
   if (*s != '\0')
     *s++ = '\0';
@@ -1972,7 +1972,7 @@  s390_insn (int ignore ATTRIBUTE_UNUSED)
 
   /* Get the opcode format.  */
   s = input_line_pointer;
-  while (*s != '\0' && *s != ',' && ! ISSPACE (*s))
+  while (! is_end_of_stmt (*s) && *s != ',' && ! is_whitespace (*s))
     s++;
   if (*s != ',')
     as_bad (_("Invalid .insn format\n"));