Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Use a newtype for remote file descriptor
Date: Thu, 26 Feb 2026 11:43:54 -0500	[thread overview]
Message-ID: <32b6cfc1-d500-462c-a14d-4999e66afe76@simark.ca> (raw)
In-Reply-To: <20260225-target-fd-newtype-v1-1-e04af6692ccb@adacore.com>

On 2/25/26 4:25 PM, Tom Tromey wrote:
> @@ -3251,25 +3251,27 @@ target_fileio_open (struct inferior *inf, const char *filename,
>        if (fd == -1 && *target_errno == FILEIO_ENOSYS)
>  	continue;
>  
> +      remote_fd result;
>        if (fd < 0)
> -	fd = -1;
> +	result = remote_fd::INVALID;
>        else
> -	fd = acquire_fileio_fd (t, fd);
> +	result = acquire_fileio_fd (t, fd);
>  
>        target_debug_printf_nofunc ("target_fileio_open (%d,%s,0x%x,0%o,%d) = %d (%d)",
> -			   inf == NULL ? 0 : inf->num, filename, flags, mode,
> -			   warn_if_slow, fd, fd != -1 ? 0 : *target_errno);
> -      return fd;
> +				  inf == NULL ? 0 : inf->num, filename,
> +				  flags, mode, warn_if_slow, int (fd),
> +				  int (fd) != -1 ? 0 : *target_errno);
> +      return result;

One more nit: in this function, you don't need to case fd to int, since
fd is an int.  You could either remove the cast, or use `result` in the
debug print.

Simon

  parent reply	other threads:[~2026-02-26 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 21:25 [PATCH 0/2] Stronger typing for remote file i/o Tom Tromey
2026-02-25 21:25 ` [PATCH 1/2] Use a newtype for remote file descriptor Tom Tromey
2026-02-26 16:38   ` Simon Marchi
2026-02-27 13:36     ` Tom Tromey
2026-02-26 16:43   ` Simon Marchi [this message]
2026-02-27 13:36     ` Tom Tromey
2026-02-25 21:25 ` [PATCH 2/2] Use enum types for remote fileio flags Tom Tromey
2026-02-26 17:10   ` Simon Marchi
2026-02-27 14:15     ` Tom Tromey

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=32b6cfc1-d500-462c-a14d-4999e66afe76@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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