Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Kartik K. Agaram" <ak@akkartik.com>
Cc: gdb-patches@sourceware.org,  guinevere@redhat.com
Subject: Re: [PATCH] RFC: gdb: redo whitespace-stripping from commands
Date: Thu, 29 May 2025 07:36:29 -0600	[thread overview]
Message-ID: <87y0ufy1wi.fsf@tromey.com> (raw)
In-Reply-To: <20250529125138.1118538-1-ak@akkartik.com> (Kartik K. Agaram's message of "Thu, 29 May 2025 05:51:38 -0700")

>>>>> "Kartik" == Kartik K Agaram <ak@akkartik.com> writes:

Thanks for the patch.

Kartik> Before this patch, trailing whitespace was not stripped:
Kartik>   - from 'set'/'show' commands
Kartik>   - from 'complete' commands

Kartik> Now I've added the 'with' commands to that list because it contains a
Kartik> 'complete' subcommand. To accomplish this, I'm trying to fix a TODO to
Kartik> provide a per-command flag controlling whitespace-stripping.

Kartik> I've also cleaned up some seemingly TODOs that are either fixed by this
Kartik> patch or obsolete.

Kartik> Open question: This patch stops stripping trailing whitespace from all
Kartik> 'with' commands. Might that create issues with other 'with' commands
Kartik> besides 'with ... -- complete'?

Maybe it would cause problems with trailing whitespace showing up in
filenames?  Or with commands that don't expect an argument.  For those
commands, completion might add a trailing space, causing the function to
be called with " " rather than nullptr.

I wonder if the 'with' command itself -- and any other commands that
invoke commands, like 'eval' -- should strip whitespace as appropriate
before invocation.  That is, move the whitespace stripping code
somewhere else.  (Assuming it's in the wrong spot, I don't recall off
the top of my head where this stuff happens.)

Kartik> +  complete_cmd->strip_trailing_white_space_p = 0;
 
Kartik> +  c->strip_trailing_white_space_p = 0;
 
Kartik> +      strip_trailing_white_space_p (1),

Kartik> +  unsigned int strip_trailing_white_space_p : 1;

This should be bool and the constants above should be true/false.

Tom

  reply	other threads:[~2025-05-29 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 12:51 Kartik K. Agaram
2025-05-29 13:36 ` Tom Tromey [this message]
2025-05-29 13:53   ` Kartik Agaram
2025-05-29 13:53   ` Guinevere Larsen
2025-05-29 13:59     ` Kartik Agaram
2025-05-29 15:35     ` Tom Tromey
2025-06-01  1:17 ` Kartik K. Agaram
2025-06-01  1:17   ` [PATCH] " Kartik K. Agaram
2025-06-02 16:30     ` Guinevere Larsen
2025-06-02 16:42       ` Kartik Agaram
2025-06-02 23:39     ` [PATCH v3] " Kartik K. Agaram
2025-06-06 16:10       ` [PATCH v4] " Kartik K. Agaram
2025-07-07 17:59         ` Kartik Agaram
2025-07-08  9:27         ` Andrew Burgess

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=87y0ufy1wi.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=ak@akkartik.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.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