public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Paul Iannetta <piannetta@kalrayinc.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH v2 22/65] kvx: use is_whitespace()
Date: Fri, 31 Jan 2025 13:34:39 +0100	[thread overview]
Message-ID: <20250131123439.kxyy3jt5lxrj5dpm@ws2202.lin.mbt.kalray.eu> (raw)
In-Reply-To: <018d8c82-9a91-45e2-9149-1cc081669c25@suse.com>

On Mon, Jan 27, 2025 at 05:21:48PM +0100, Jan Beulich wrote:
> 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 where tabs were
> already included. At the same time use is_end_of_stmt() instead of open-
> coded checks in adjacent code.
> ---
> read_token()'s check for \n looks odd to me; I'm hence leaving it alone.
> ---
> v2: New.
> 
> --- a/gas/config/kvx-parse.c
> +++ b/gas/config/kvx-parse.c
> @@ -597,12 +597,12 @@ read_token (struct token_s *tok)
>      {
>        if ('0' <= str[*begin - i] && str[*begin - i] <= '9')
>  	last_imm_p = 1;
> -      else if (str[*begin - i] != ' ' && str[*begin - i] != '\t')
> +      else if (!is_whitespace (str[*begin - i]))
>  	break;
>      }
>  
>    /* Eat up all leading spaces.  */
> -  while (str[*begin] && (str[*begin] == ' ' || str[*begin] == '\n'))
> +  while (str[*begin] && (is_whitespace (str[*begin]) || str[*begin] == '\n'))
>      *begin += 1;
>  

I think the check str[*begin] == '\n' can be safely dropped.  This
should never happen.  Thank you for pointing it out.

>    *end = *begin;
> @@ -624,7 +624,9 @@ read_token (struct token_s *tok)
>        }
>  
>        if (str[*begin] == '.'
> -	  && (!(*begin > 0 && (str[*begin - 1] == ' ' || is_delim(str[*begin - 1])))
> +	  && (!(*begin > 0
> +		&& (is_whitespace (str[*begin - 1])
> +		    || is_delim (str[*begin - 1])))
>  	    || last_imm_p))
>  	modifier_p = 1;
>  
> @@ -633,7 +635,8 @@ read_token (struct token_s *tok)
>  	*end += 1;
>  
>        /* Stop when reaching the start of the new token. */
> -      while (!(!str[*end] || is_delim (str[*end]) || str[*end] == ' ' || (modifier_p && str[*end] == '.')))
> +      while (!(!str[*end] || is_delim (str[*end]) || is_whitespace (str[*end])
> +	     || (modifier_p && str[*end] == '.')))
>  	*end += 1;
>  
>      }
> --- a/gas/config/tc-kvx.c
> +++ b/gas/config/tc-kvx.c
> @@ -1279,7 +1279,7 @@ md_assemble (char *line)
>    if (get_byte_counter (now_seg) & 3)
>      as_fatal ("code segment not word aligned in md_assemble");
>  
> -  while (line_cursor && line_cursor[0] && (line_cursor[0] == ' '))
> +  while (is_whitespace (line_cursor[0]))
>      line_cursor++;
>  
>    /* ;; was converted to "be" by line hook          */
> @@ -2125,7 +2125,7 @@ kvx_md_start_line_hook (void)
>  {
>    char *t;
>  
> -  for (t = input_line_pointer; t && t[0] == ' '; t++);
> +  for (t = input_line_pointer; is_whitespace (t[0]); t++);
>  
>    /* Detect illegal syntax patterns:
>     * - two bundle ends on the same line: ;; ;;
> @@ -2144,9 +2144,9 @@ kvx_md_start_line_hook (void)
>        while (tmp_t && tmp_t[0])
>  	{
>  	  while (tmp_t && tmp_t[0] &&
> -		 ((tmp_t[0] == ' ') || (tmp_t[0] == '\n')))
> +		 (is_whitespace (tmp_t[0]) || is_end_of_stmt (tmp_t[0])))
>  	    {
> -	      if (tmp_t[0] == '\n')
> +	      if (is_end_of_stmt (tmp_t[0]))
>  		newline_seen = true;
>  	      tmp_t++;
>  	    }
> 
> 
> 
> 
> 

Thank you for doing this. I've applied your patch and tested it, and
it looks fine to me.

Paul





  reply	other threads:[~2025-01-31 12:34 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 15:23 [PATCH v2 00/65] gas: whitespace handling Jan Beulich
2025-01-27 15:26 ` [PATCH v2 01/65] gas: consolidate whitespace recognition Jan Beulich
2025-01-31  6:02   ` Hans-Peter Nilsson
2025-01-31  8:36     ` Jan Beulich
2025-01-27 15:27 ` [PATCH v2 02/65] gas/obj-*.c: use is_whitespace() Jan Beulich
2025-01-27 15:43 ` [PATCH v2 03/65] Alpha/EVAX: use is_whitespace() / is_end_of_stmt() Jan Beulich
2025-01-27 15:44 ` [PATCH v2 04/65] arc: use is_whitespace() Jan Beulich
2025-01-27 15:50 ` [PATCH v2 05/65] Arm: " Jan Beulich
2025-01-27 16:31   ` Richard Earnshaw (lists)
2025-01-27 16:55     ` Jan Beulich
2025-01-27 17:05       ` Richard Earnshaw (lists)
2025-01-27 15:50 ` [PATCH v2 06/65] aarch64: " Jan Beulich
2025-01-27 16:31   ` Richard Earnshaw (lists)
2025-01-27 16:06 ` [PATCH v2 07/65] avr: " Jan Beulich
2025-01-27 16:07 ` [PATCH v2 08/65] bfin: " Jan Beulich
2025-01-27 16:08 ` [PATCH v2 09/65] bpf: " Jan Beulich
2025-01-28  9:21   ` Alan Modra
2025-01-28 10:31     ` Jan Beulich
2025-01-27 16:09 ` [PATCH v2 10/65] CR16: " Jan Beulich
2025-01-27 16:10 ` [PATCH v2 11/65] cris: " Jan Beulich
2025-01-27 16:22   ` Hans-Peter Nilsson
2025-01-27 16:12 ` [PATCH v2 12/65] CRx: " Jan Beulich
2025-01-27 16:13 ` [PATCH v2 13/65] C-Sky: " Jan Beulich
2025-01-27 16:14 ` [PATCH v2 14/65] d10v: " Jan Beulich
2025-01-27 16:14 ` [PATCH v2 15/65] d30v: " Jan Beulich
2025-01-27 16:15 ` [PATCH v2 16/65] dlx: " Jan Beulich
2025-01-27 16:16 ` [PATCH v2 17/65] Epiphany: " Jan Beulich
2025-01-27 16:17 ` [PATCH v2 18/65] fr30: " Jan Beulich
2025-01-27 16:19 ` [PATCH v2 19/65] ft32: " Jan Beulich
2025-01-27 16:20 ` [PATCH v2 20/65] H8/300: " Jan Beulich
2025-01-27 16:20 ` [PATCH v2 21/65] HP-PA: " Jan Beulich
2025-01-27 22:50   ` John David Anglin
2025-01-28  7:19     ` Jan Beulich
2025-01-28 18:19       ` John David Anglin
2025-01-27 16:21 ` [PATCH v2 22/65] kvx: " Jan Beulich
2025-01-31 12:34   ` Paul Iannetta [this message]
2025-01-27 16:22 ` [PATCH v2 23/65] LoongArch: " Jan Beulich
2025-01-27 16:23 ` [PATCH v2 24/65] m32c: " Jan Beulich
2025-01-27 16:23 ` [PATCH v2 25/65] m32r: " Jan Beulich
2025-01-27 16:24 ` [PATCH v2 26/65] M68HC1x: " Jan Beulich
2025-01-27 16:25 ` [PATCH v2 27/65] M68k: " Jan Beulich
2025-01-27 16:25 ` [PATCH v2 28/65] M*Core: " Jan Beulich
2025-01-27 16:26 ` [PATCH v2 29/65] metag: " Jan Beulich
2025-01-27 16:26 ` [PATCH v2 30/65] MicroBlaze: " Jan Beulich
2025-01-29 23:56   ` Michael Eager
2025-01-27 16:28 ` [PATCH v2 31/65] MIPS: " Jan Beulich
2025-02-03 14:07   ` Maciej W. Rozycki
2025-02-03 15:52     ` Jan Beulich
2025-02-03 17:50       ` Maciej W. Rozycki
2025-02-10 22:17         ` Maciej W. Rozycki
2025-01-27 16:28 ` [PATCH v2 32/65] MMIX: " Jan Beulich
2025-01-31  6:18   ` Hans-Peter Nilsson
2025-01-31  6:33   ` Hans-Peter Nilsson
2025-01-31  6:54     ` Jan Beulich
2025-01-31  7:05       ` Hans-Peter Nilsson
2025-02-03  6:54   ` Hans-Peter Nilsson
2025-02-03  7:30     ` Jan Beulich
2025-02-05  6:22       ` Hans-Peter Nilsson
2025-02-05  7:14         ` Jan Beulich
2025-01-27 16:29 ` [PATCH v2 33/65] mn10200: " Jan Beulich
2025-01-27 16:29 ` [PATCH v2 34/65] mn10300: " Jan Beulich
2025-02-07  6:55   ` Alexandre Oliva
2025-01-27 16:30 ` [PATCH v2 35/65] Moxie: " Jan Beulich
2025-01-27 16:31 ` [PATCH v2 36/65] msp430: " Jan Beulich
2025-01-27 16:31 ` [PATCH v2 37/65] nds32: " Jan Beulich
2025-01-27 16:32 ` [PATCH v2 38/65] NS32k: " Jan Beulich
2025-01-27 16:32 ` [PATCH v2 39/65] PDP11: " Jan Beulich
2025-01-27 16:33 ` [PATCH v2 40/65] PicoJava: " Jan Beulich
2025-01-27 16:33 ` [PATCH v2 41/65] PPC: " Jan Beulich
2025-01-27 22:36   ` Peter Bergner
2025-01-27 16:34 ` [PATCH v2 42/65] pru: " Jan Beulich
2025-01-27 16:34 ` [PATCH v2 43/65] RISC-V: " Jan Beulich
2025-01-27 16:35 ` [PATCH v2 44/65] rl78: " Jan Beulich
2025-01-27 16:35 ` [PATCH v2 45/65] rx: " Jan Beulich
2025-01-27 16:36 ` [PATCH v2 46/65] s12z: " Jan Beulich
2025-01-27 16:36 ` [PATCH v2 47/65] S/390: " Jan Beulich
2025-01-30  8:38   ` Jens Remus
2025-01-30  9:11     ` Jan Beulich
2025-01-27 16:37 ` [PATCH v2 48/65] Score: " Jan Beulich
2025-01-27 16:37 ` [PATCH v2 49/65] SH: " Jan Beulich
2025-02-07  6:54   ` Alexandre Oliva
2025-01-27 16:38 ` [PATCH v2 50/65] Sparc: " Jan Beulich
2025-01-27 16:38 ` [PATCH v2 51/65] spu: " Jan Beulich
2025-01-27 16:39 ` [PATCH v2 52/65] C30: " Jan Beulich
2025-01-27 16:40 ` [PATCH v2 53/65] C4x: " Jan Beulich
2025-01-27 16:40 ` [PATCH v2 54/65] C54x: " Jan Beulich
2025-01-27 16:41 ` [PATCH v2 55/65] C6x: " Jan Beulich
2025-01-27 16:42 ` [PATCH v2 56/65] v850: " Jan Beulich
2025-01-27 16:42 ` [PATCH v2 57/65] VAX: " Jan Beulich
2025-01-27 20:46   ` Jan-Benedict Glaw
2025-01-27 16:43 ` [PATCH v2 58/65] Visium: " Jan Beulich
2025-01-27 16:43 ` [PATCH v2 59/65] wasm32: " Jan Beulich
2025-01-27 16:44 ` [PATCH v2 60/65] x86: " Jan Beulich
2025-01-27 16:45 ` [PATCH v2 61/65] xgate: " Jan Beulich
2025-01-27 16:45 ` [PATCH v2 62/65] Xtensa: " Jan Beulich
2025-01-27 16:46 ` [PATCH v2 63/65] Z80: " Jan Beulich
2025-01-27 16:46 ` [PATCH v2 64/65] Z8k: " Jan Beulich
2025-01-30 10:16   ` Christian Groessler
2025-01-27 16:47 ` [PATCH v2 65/65] gas: suppress use of ISSPACE() / ISBLANK() Jan Beulich
2025-01-28  2:50 ` [PATCH v2 00/65] gas: whitespace handling Hans-Peter Nilsson
2025-01-28  7:40   ` Jan Beulich
2025-01-28 14:47     ` Richard Earnshaw (lists)
2025-01-28 15:00       ` Jan Beulich
2025-01-28 15:27         ` Richard Earnshaw (lists)
2025-01-28 15:25     ` Hans-Peter Nilsson
2025-01-28  9:59 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250131123439.kxyy3jt5lxrj5dpm@ws2202.lin.mbt.kalray.eu \
    --to=piannetta@kalrayinc.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).